[LLVMbugs] [Bug 204] NEW: [llvmg++] Dynamically initialized constants cannot be marked 'constant'
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun Jan 11 15:46:12 PST 2004
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=204
Summary: [llvmg++] Dynamically initialized constants cannot be
marked 'constant'
Product: tools
Version: 1.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: llvm-g++
AssignedTo: sabre at nondot.org
ReportedBy: sabre at nondot.org
The C++ front-end is currently marking globals 'constant' if they are constant
in the source language. However, in C++, some constant initializers cannot be
computed statically, so dynamic initializers are emitted. In this case, the
value is modified at runtime, so the global cannot be marked as an LLVM constant.
Testcase:
---
extern int X;
const int Y = X;
const int* foo() { return &Y; }
---
The pertinent output:
---
...
%Y = internal constant int 0 ;;; Should not be marked as 'constant'!
...
store int %tmp.4.i, int* %Y
...
---
Fixing this is just a matter of figuring out how GCC encodes this condition.
-Chris
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list