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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to