This code gives "0 0" at first call to printf (wrong) and "4 4" at second call (good). Works correctly with -O1, errors occur with -Os or -O2 or above. void read8(int *x) { x[0] = 4; x[1] = 4;} int main() { static double equiv[1]; double r; read8(&r); *(equiv) = r; printf("%d %d\n",((int *)equiv)[0],((int *)equiv)[1]); printf("%d %d\n",((int *)equiv)[0],((int *)equiv)[1]); return 0; }
-- Summary: Wrong code in gcc-3.3.5 and gcc-3.4.2 (4.0 not checked) Product: gcc Version: 3.3.5 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: strasbur at chkw386 dot ch dot pwr dot wroc dot pl CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i386-pc-linux GCC host triplet: i386-pc-linux GCC target triplet: i386-pc-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18156