[LLVMbugs] [Bug 9683] New: Assert generated when clang GEP's into nested unnamed structs

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 11 13:52:32 PDT 2011


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

           Summary: Assert generated when clang GEP's into nested unnamed
                    structs
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mburke at ea.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


I have the following program that, when built with clang (linux-x64), generates
an assertion:

#include <stdint.h>

typedef __uint128_t uint128_t;

struct QueueEntry
{
    union
    {
        struct
        {
            void*    mPtr;
            union
            {
                struct 
                {
                    uint8_t         mAffinity;
                    uint8_t         mPriority;
                    uint16_t        mSubmissionId;
                };
                uint32_t mSubmissionTag;
            };
            uint32_t        mPad;
        };

        struct
        {
            uintptr_t       mInstancePtr;
            uint32_t        mEnabler;
        };

        uint128_t mValue;
    };

    QueueEntry()
        : mValue(0)
    {}
};

The assertion text:


clang: /home/mburke/src/llvm/include/llvm/Instructions.h:278: const llvm::Type*
llvm::checkType(const llvm::Type*): Assertion `Ty && "Invalid GetElementPtrInst
indices for type!"' failed.
0  clang           0x0000000001824e3f
1  clang           0x00000000018270b2
2  libpthread.so.0 0x00007f7e4738db40
3  libc.so.6       0x00007f7e4668bba5 gsignal + 53
4  libc.so.6       0x00007f7e4668f6b0 abort + 384
5  libc.so.6       0x00007f7e46684a71 __assert_fail + 241
6  clang           0x00000000007a5a47
7  clang           0x00000000007aefdc llvm::IRBuilder<true,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true>
>::CreateStructGEP(llvm::Value*, unsigned int, llvm::Twine const&) + 188
8  clang           0x00000000007eff30
clang::CodeGen::CodeGenFunction::EmitLValueForField(llvm::Value*,
clang::FieldDecl const*, unsigned int) + 352
9  clang           0x00000000007f03c4
clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization(llvm::Value*,
clang::FieldDecl const*, unsigned int) + 100
10 clang           0x00000000007c25f5
clang::CodeGen::CodeGenFunction::EmitCtorPrologue(clang::CXXConstructorDecl
const*, clang::CXXCtorType, clang::CodeGen::FunctionArgList&) + 885
11 clang           0x00000000007c3356
clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&)
+ 134
12 clang           0x0000000000899d93
clang::CodeGen::CodeGenFunction::GenerateCode(clang::CodeGen::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 947
13 clang           0x00000000007b0a8d
clang::CodeGen::CodeGenModule::EmitCXXConstructor(clang::CXXConstructorDecl
const*, clang::CXXCtorType) + 205
14 clang           0x000000000079315a
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::CodeGen::GlobalDecl)
+ 426
15 clang           0x00000000007932b7
clang::CodeGen::CodeGenModule::EmitDeferred() + 151
16 clang           0x0000000000793339 clang::CodeGen::CodeGenModule::Release()
+ 9
17 clang           0x0000000000785a78
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 104
18 clang           0x00000000008b24cd clang::ParseAST(clang::Sema&, bool) + 413
19 clang           0x0000000000784e84 clang::CodeGenAction::ExecuteAction() +
68
20 clang           0x0000000000675dd3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 371
21 clang           0x000000000064ed24
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1268
22 clang           0x0000000000645c0b cc1_main(char const**, char const**, char
const*, void*) + 683
23 clang           0x000000000064db35 main + 6277
24 libc.so.6       0x00007f7e46676d8e __libc_start_main + 254
25 clang           0x0000000000644179
Stack dump:
0.    Program arguments: /home/mburke/src/build/Release+Asserts/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name test2.cpp -mrelocation-model static -mdisable-fp-elim
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.20.51 -momit-leaf-frame-pointer -resource-dir
/home/mburke/src/build/Release+Asserts/bin/../lib/clang/3.0 -ferror-limit 19
-fmessage-length 120 -fcxx-exceptions -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o test2.o -x c++ test2.cpp 
1.    <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    test2.cpp:34:5: Generating code for declaration 'QueueEntry::QueueEntry'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)



clang -v:
clang version 3.0 (trunk 129282)
Target: x86_64-unknown-linux-gnu
Thread model: posix

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