http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49413
Summary: over-optimization that causes valid code to segfault Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: gat...@gmail.com Created attachment 24529 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24529 source code The attached short .c code compiles without warnings and segfaults when -O3 is used. The code runs fine with -O1 or if I declare v as "volatile double *" instead of just "double *". This was triggered in a much larger code base. I've managed to strip everything else out and reduce it to this. I'm pretty sure the code left is correct, so I think it's a GCC bug. GCC Version: 4.6.0 w/ gmp-5.0.2, mpc-0.9, mpfr-3.0.1 System: CentOS 5 x86_64 (AMD Istanbull) GCC ./configure flags: --enable-languages=c,c++,fortran Source compilation command: gcc -O3 volatile.c -o volatile