[LLVMbugs] [Bug 9893] New: "Invalid GetElementPtrInst indices for type!" on valid structure

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 10 16:10:15 PDT 2011


           Summary: "Invalid GetElementPtrInst indices for type!" on valid
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: alonzakai at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

The following code fails to compile with clang:

#include "stdio.h"

struct usvec
  int x;

struct shaftbb
    int v[2];
    struct { usvec min, max; };

  shaftbb() {}

int main()
    shaftbb s;
    return 1;

The error is 

clang: /home/alon/Dev/llvm-svn/include/llvm/Instructions.h:278: const
llvm::Type* llvm::checkType(const llvm::Type*): Assertion `Ty && "Invalid
GetElementPtrInst indices for type!"' failed.
0  clang 0x095746a8
Stack dump:
0.    Program arguments:
/home/alon/Dev/llvm-svn/build/Release+Asserts/bin/clang -cc1 -triple
i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name llvm1.cpp
-mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases
-target-cpu pentium4 -target-linker-version 2.20.1 -momit-leaf-frame-pointer
-ferror-limit 19 -fmessage-length 141 -fcxx-exceptions -fexceptions
-fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-ImS38f.o
-x c++ llvm1.cpp 
1.    <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    llvm1.cpp:16:3: Generating code for declaration 'shaftbb::shaftbb'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see

The file compiles ok with gcc.

This is a reduced testcase from pvs.cpp from Sauerbraten (open source FPS)
which I am trying to compile with clang.

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