Skip to content

"Invalid GetElementPtrInst indices for type!" on valid structure #10265

@kripken

Description

@kripken
Bugzilla Link 9893
Resolution FIXED
Resolved on Oct 09, 2011 23:20
Version 2.9
OS Linux
CC @DougGregor,@rjmccall

Extended Description

The following code fails to compile with clang:

======
#include "stdio.h"

struct usvec
{
int x;
};

struct shaftbb
{
union
{
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 -resource-dir /home/alon/Dev/llvm-svn/build/Release+Asserts/bin/../lib/clang/3.0 -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. 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 invocation)
    ======

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions