[LLVMbugs] [Bug 9891] New: static const struct optimized-away incorrectly by llvm-gcc
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 10 13:07:31 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9891
Summary: static const struct optimized-away incorrectly by
llvm-gcc
Product: new-bugs
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: stash at cpan.org
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=6573)
--> (http://llvm.org/bugs/attachment.cgi?id=6573)
Program that fails to run correctly after compiling with llvm-gcc
An anonymous struct defined as "static const" seems to be optimized-away when
llvm-gcc is given the '-O' flag. I'd expect the attached program to print
something, but it does not.
The following things seem to restore correct behaviour:
* change "static const" to just "const" (i.e. don't use a static initializer)
* use gcc instead of llvm-gcc
* compile *without* the -O flag (or use -O0)
I saw that clang doesn't currently support static initialization of flexible
members, but the struct in this program isn't a member of anything.
I'm not sure that this is an llvm bug since I'm using Apple's llvm-gcc included
in Xcode 4.0.2. --version:
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658)
(LLVM build 2335.9)
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list