[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#425343: [arm] gcc-4.1: bad code and no warning for thumb assembly of arm instruction



tag 425343 + moreinfo
thanks

please recheck with 4.2 and 4.3/snapshot

John Reiser writes:
> Subject: [arm] gcc-4.1: bad code and no warning for thumb assembly of arm instruction
> Package: gcc-4.1
> Version: 4.1.1-21
> Severity: normal
> 
> *** Please type your report below this line ***
> The assembler generates an incorrect instruction without warning
> when assembling this arm instruction in thumb mode:
>         .code 16
>         mov r1,r0,lsr #4  // arm instruction
> The generated code is the thumb instruction:
>         movs r1,r0   //  .word 0x1c01
> and the shift has been ignored silently.
> 
> The expected behavior is to generate the equivalent thumb instruction
> [equivalent except that thumb mode always sets condition codes
> while arm mode does not]:
>         lsrs r1,r0,#4  // .word 0x0901
> Or, the assembler could complain
>         bad syntax: unexpected ",lsr #4"
> But generating bad code with no warning is not acceptable.
> 
> $ gcc --version
> gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
> $
> 
> -- System Information:
> Debian Release: 4.0
>   APT prefers stable
>   APT policy: (500, 'stable')
> Architecture: arm (armv5tel)
> Shell:  /bin/sh linked to /bin/bash
> Kernel: Linux 2.6.18-3-ixp4xx
> Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
> 
> Versions of packages gcc-4.1 depends on:
> ii  binutils                    2.17-3       The GNU assembler, linker and bina
> ii  cpp-4.1                     4.1.1-21     The GNU C preprocessor
> ii  gcc-4.1-base                4.1.1-21     The GNU Compiler Collection (base
> ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
> ii  libgcc1                     1:4.1.1-21   GCC support library
> ii  libssp0                     4.1.1-21     GCC stack smashing protection libr




Reply to: