arm-none-eabi-gcc miscompiles code sequence
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
Invalid
|
Critical
|
Unassigned |
Bug Description
* Release version:
Problem seen in all of 4_8-2014q3-
* Host
Using binary releases for both MacOS and Linux, as downloaded directly from launchpad. The disassembly files attached were produced on MacOS with 2015q1
* Test case/symptom
The simple code sequence in the lnat.c file attached is being miscompiled at any optimization level other than O0.
Specifically the code generated for the while statement:
li = 0;
while ( ((b.A[id][li] & 0x80) == 0) && (li < 6) ) {
}
is completely missing the (li < 6) test. When linked together with test.c and run, the output is:
lnat: id 0, li 12
lnat: id 0, li 12
showing that li is allowed to go past the limit of 6.
Changed in gcc-arm-embedded: | |
status: | New → Confirmed |
importance: | Undecided → Critical |
Incredible to be wrong with such a simple case. Thanks reporting and will verify it tomorrow.