This C++ code snippet aborts on amd64 and i386 if compiled with -O[23]: (Note: tree dumps are correct)
------------------------------------------------------------------------------- extern "C" void abort (void); struct T {}; struct U : T {}; int main () { int i; U *p; T **q; for (i = 0; i < 2; i++) { q = (T **) &p; *q = 0; if (p) abort (); } return 0; } ------------------------------------------------------------------------------- The above bug shows as Mozilla Firefox segfault in function imgRequest::NotifyProxyListener(imgRequestProxy *) when pressing 'reload' button, and the testcase was reduced from function imgCacheValidator::OnStartRequest(nsIRequest *, nsISupports *), here is part of original code: NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt) { ... for (PRInt32 i = count-1; i>=0; i--) { imgRequestProxy *proxy; mProxies.GetElementAt(i, (nsISupports**)&proxy); mRequest->NotifyProxyListener(proxy); NS_RELEASE(proxy); } ... -- Summary: [4.0/4.1 regression] -fstrict-aliasing causes miscompilation Product: gcc Version: 4.0.1 Status: UNCONFIRMED Keywords: wrong-code Severity: critical Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: belyshev at depni dot sinp dot msu dot ru CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21450