This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/18156] New: Wrong code in gcc-3.3.5 and gcc-3.4.2 (4.0 not checked)
- From: "strasbur at chkw386 dot ch dot pwr dot wroc dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Oct 2004 11:03:39 -0000
- Subject: [Bug c/18156] New: Wrong code in gcc-3.3.5 and gcc-3.4.2 (4.0 not checked)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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