[LLVMbugs] [Bug 10911] New: Anonymous struct as member in non POD class fails to compile under certain situations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 11 14:54:48 PDT 2011


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

           Summary: Anonymous struct as member in non POD class fails to
                    compile under certain situations
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: joshuacweinberg at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=7252)
 --> (http://llvm.org/bugs/attachment.cgi?id=7252)
Test code (and Xcode project)

Naming the struct resolves the issue, but there shouldn't be an issue with the
anon struct.

Compiler output:
0  clang             0x00000001085bc212 _ZL15PrintStackTracePv + 34
1  clang             0x00000001085bc6e9 _ZL13SignalHandleri + 633
2  libsystem_c.dylib 0x00007fff8b694cfa _sigtramp + 26
3  libsystem_c.dylib 0x0000000008c19250 _sigtramp + 18446603338324133232
4  clang             0x0000000107a8db5a
llvm::GetElementPtrInst::GetElementPtrInst<llvm::Value**>(llvm::Value*,
llvm::Value**, llvm::Value**, unsigned int, llvm::Twine const&,
llvm::Instruction*) + 202
5  clang             0x0000000107e6dad9 llvm::IRBuilder<false,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<false>
>::CreateConstInBoundsGEP2_32(llvm::Value*, unsigned int, unsigned int,
llvm::Twine const&) + 185
6  clang             0x0000000107a8d7bc
clang::CodeGen::CodeGenFunction::EmitLValueForField(llvm::Value*,
clang::FieldDecl const*, unsigned int) + 492
7  clang             0x0000000107ce3045
clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization(llvm::Value*,
clang::FieldDecl const*, unsigned int) + 85
8  clang             0x0000000107cde5fa
clang::CodeGen::CodeGenFunction::EmitCtorPrologue(clang::CXXConstructorDecl
const*, clang::CXXCtorType, clang::CodeGen::FunctionArgList&) + 1322
9  clang             0x0000000107cddd14
clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&)
+ 340
10 clang             0x0000000107e5fe83
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 675
11 clang             0x0000000107cddb83
clang::CodeGen::CodeGenModule::EmitCXXConstructor(clang::CXXConstructorDecl
const*, clang::CXXCtorType) + 243
12 clang             0x0000000107e618ed
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 285
13 clang             0x0000000107e6234d
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 605
14 clang             0x00000001078490f7
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 311
15 clang             0x00000001078490bb
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 251
16 clang             0x0000000107848f9f (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 95
17 clang             0x0000000107848f11
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 161
18 clang             0x000000010781cff2 clang::ParseAST(clang::Sema&, bool) +
290
19 clang             0x000000010781baaf clang::CodeGenAction::ExecuteAction() +
671
20 clang             0x000000010780789b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 875
21 clang             0x0000000107805918
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2696
22 clang             0x00000001077fa115 cc1_main(char const**, char const**,
char const*, void*) + 5333
23 clang             0x00000001077dd27b main + 667
24 clang             0x00000001077dcfd4 start + 52
25 clang             0x0000000000000052 start + 18446744069288898738
Stack dump:
0.    Program arguments: /Developer/usr/bin/clang -cc1 -triple
x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name TestClass.cpp -pic-level 1
-mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu
core2 -target-linker-version 127 -g -coverage-file
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/Objects-normal/x86_64/TestClass.o
-resource-dir /Developer/usr/bin/../lib/clang/3.0 -dependency-file
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/Objects-normal/x86_64/TestClass.d
-MT dependencies -isysroot /Developer/SDKs/MacOSX10.7.sdk -iquote
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/AnonUnion-generated-files.hmap
-iquote
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/AnonUnion-project-headers.hmap
-D DEBUG=1 -I
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/AnonUnion-own-target-headers.hmap
-I
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/AnonUnion-all-target-headers.hmap
-I
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Products/Debug/include
-I
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/DerivedSources/x86_64
-I
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/DerivedSources
-F/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Products/Debug
-O0 -Wno-trigraphs -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch
-Wno-unused-parameter -Wunused-variable -Wunused-value -Wshorten-64-to-32
-Wc++0x-extensions -Wno-sign-conversion -fdeprecated-macro -ferror-limit 19
-fmessage-length 0 -fvisibility-inlines-hidden
-fdiagnostics-print-source-range-info -fdiagnostics-parseable-fixits
-stack-protector 1 -fblocks -fcxx-exceptions -fexceptions -fpascal-strings
-fdiagnostics-show-option -fdiagnostics-show-category id -o
/Users/jweinberg/Library/Developer/Xcode/DerivedData/AnonUnion-dnprncphbwlxlphjiptrydjahpge/Build/Intermediates/AnonUnion.build/Debug/AnonUnion.build/Objects-normal/x86_64/TestClass.o
-x c++ /Users/jweinberg/Development/AnonUnion/AnonUnion/TestClass.cpp 
1.    <eof> parser at end of file
2.    /Users/jweinberg/Development/AnonUnion/AnonUnion/TestClass.cpp:13:11:
LLVM IR generation of declaration 'Test'
3.    /Users/jweinberg/Development/AnonUnion/AnonUnion/TestClass.cpp:15:16:
Generating code for declaration 'Test::TestClass::TestClass'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)

Compiler version is
Apple clang version 3.0 (tags/Apple/clang-211.9) (based on LLVM 3.0svn)

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