[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [LLVMbugs] [Bug 204] NEW: [llvmg++] Dynamically initialized constants cannot be marked 'constant'
From:       bugzilla-daemon () cs ! uiuc ! edu
Date:       2004-01-11 23:46:12
Message-ID: 200401112346.RAA30297 () zion ! cs ! uiuc ! edu
[Download RAW message or body]

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@nondot.org
        ReportedBy: sabre@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.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic