[LLVMbugs] [Bug 11724] New: Crash when using union in C++11: "Constant expressions should be initialized" UNREACHABLE

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 8 04:42:17 PST 2012


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

             Bug #: 11724
           Summary: Crash when using union in C++11: "Constant expressions
                    should be initialized" UNREACHABLE
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: devlists at shadowlab.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7851
  --> http://llvm.org/bugs/attachment.cgi?id=7851
Reduced test case

clang crash while trying to compile the following simple code in c++11 mode:

------- MachOObjectFile.cpp

union DataRefImpl {
  int c;
};

void getRelocationValueString(DataRefImpl Rel) {        
  DataRefImpl RelNext = Rel;
}

-----------------

clang++ -std=c++11 MachOObjectFile.cpp
Constant expressions should be initialized.
UNREACHABLE executed at
/Users/jddupas/Projects/OpenSource/llvm/tools/clang/lib/CodeGen/CGExprConstant.cpp:910!
…
Stack dump:
0.    Program arguments: /opt/llvm/stage1/bin/clang -cc1 -triple
x86_64-apple-macosx10.7.2 -emit-obj -mrelax-all -disable-free -main-file-name
MachOObjectFile.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 127.2 -resource-dir
/opt/llvm/stage1/bin/../lib/clang/3.1 -fmodule-cache-path
/var/folders/nz/b9j_xhvx7rzbh2m570r_1dsr0000gn/T/clang-module-cache -std=c++11
-fdeprecated-macro -fdebug-compilation-dir /Users/jddupas/Desktop -ferror-limit
19 -fmessage-length 170 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/nz/b9j_xhvx7rzbh2m570r_1dsr0000gn/T/MachOObjectFile-T3mCnF.o -x
c++ MachOObjectFile.cpp 
1.    <eof> parser at end of file
2.    MachOObjectFile.cpp:6:6: LLVM IR generation of declaration
'getRelocationValueString'
3.    MachOObjectFile.cpp:6:6: Generating code for declaration
'getRelocationValueString'
4.    MachOObjectFile.cpp:6:48: LLVM IR generation of compound statement ('{}')

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