bad assembler produced: Error: bit-field extends past end of register -- `ubfx r0,r0,#30,#10'
Bug #771903 reported by
Dr. David Alan Gilbert
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro GCC |
Fix Released
|
Low
|
Unassigned | ||
4.5 |
Won't Fix
|
Low
|
Unassigned | ||
gcc |
Confirmed
|
Medium
|
Bug Description
The attached example program, kindly generated by a colleague, fails with:
gcc -O3 arm_bit_extract.c
/tmp/ccOOK26S.s: Assembler messages:
/tmp/ccOOK26S.s:97: Error: bit-field extends past end of register -- `ubfx r0,r0,#30,#10'
The compiler is 4.5.2-8ubuntu1
It's questionable whether the results of the shifts done by the original program are actually defined,
but it shouldn't produce bad asm.
Dave
Changed in gcc: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
To post a comment you must log in.
Thank you for the bug report. I've confirmed this with gcc-linaro- 4.5-2011. 04-0 on ARM:
michaelh@ ursa1:~ /linaro/ bugs$ /tools/ toolchains/ arch/armv7l/ gcc-linaro- 4.5-2011. 04-0-armv7l- maverick- cbuild112- ursa3-cortexa8r 1/bin/gcc -O3 -c arm_bit_extract.c
/tmp/ccl0OX6a.s: Assembler messages:
/tmp/ccl0OX6a.s:97: Error: bit-field extends past end of register -- `ubfx r0,r0,#30,#10'
The assembler is correct - the instruction attempts to extract bits 30 to 39 from a 32 bit register.
The fault also exists in gcc-4.5.2. It does not exist in gcc-4.6.0. Could you please also report this in GCC bugzilla and attach it to this ticket?
I've set it to low priority as it is a ftbfs, occurs at high optimisation levels, the fault exists upstream, and the code uses undefined behavior by shifting by a negative amount.