This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/49413] New: over-optimization that causes valid code to segfault
- From: "gattis at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Jun 2011 00:32:07 +0000
- Subject: [Bug c/49413] New: over-optimization that causes valid code to segfault
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: gattis@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