gcc-4.2.3 on Hardy/ia32 miscompiles simple code
Bug #256797 reported by
John Regehr
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.2 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Hardy |
Fix Released
|
High
|
Matthias Klose |
Bug Description
Binary package hint: gcc-4.2
This is bizarre... gcc-4.2.3 for Hardy on ia32 compiles the code below into a program that prints 1. The correct answer is 0, and this is what all other compilers (including gcc-4.1 and gcc-3.4 on Hardy/ia32) return.
Furthermore, FSF gcc-4.2.3 also gives the correct answer!
Probably someone should look into this as comparison errors like this could easily have security implications.
#include <stdio.h>
int func_1 (void)
{
signed char l_11 = 1;
unsigned char l_12 = -1;
return (l_11 > l_12);
}
int main (void)
{
printf ("%d\n", func_1());
return 0;
}
Changed in gcc-4.2: | |
status: | Confirmed → Triaged |
Changed in gcc-4.2: | |
status: | Triaged → In Progress |
To post a comment you must log in.
I can confirm this with
gcc:
Installed: 4:4.2.3-1ubuntu6