[LLVMbugs] [Bug 3398] New: IRGen crash with pointer cast to int in static var

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jan 24 18:39:01 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=3398

           Summary: IRGen crash with pointer cast to int in static var
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


Testcase:
int a() {static unsigned b = (unsigned)a;}

Result with "clang -emit-llvm":
clang: /home/eli/llvm/tools/clang/lib/CodeGen/CGDecl.cpp:93: llvm::GlobalValue*
clang::CodeGen::CodeGenFunction::GenerateStaticBlockVarDecl(const
clang::VarDecl&, bool, const char*): Assertion
`getContext().getLangOptions().CPlusPlus && "only C++ supports non-constant
static initializers!"' failed.

This bug is of a similar nature to a couple I've been committing fixes for:
roughly, if Sema::CheckForConstantInitializer thinks an initializer for a
static local variable is constant, but Expr::isConstantInitializer disagrees,
we hit this assertion in CodeGen.

I think this is basically the last significant case where this disagreement
exists; the reason I'm filing it rather than fixing it myself is that I'm not
sure what the best way to fix this particular bug is.


-- 
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