Using -O2 or greater, when taking the address of an input argument results in the wrong code. For example:
int foo (double d) { int *p = (int *) &d; return (*p); } With -O2 results in: foo: movq -8(%rsp), %eax ret With -O1 results in: foo: movsd %xmm0, -8(%rsp) movq -8(%rsp), %eax ret -- Summary: [x86_64] Wrong Code When Taking Address of Argument Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: evandro at yahoo dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21788