[LLVMbugs] [Bug 11519] New: "GEP is not of right type for indices!"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 9 03:08:03 PST 2011


             Bug #: 11519
           Summary: "GEP is not of right type for indices!"
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-link
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: max at duempel.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Got the "GEP is not of right type for indices!" while trying to link all .bc
files of a large project (C and C++ compiled with clang).

GEP is not of right type for indices!
  %d_stream = getelementptr inbounds %bar* %fp, i64 0, i32 0
 i32Broken module found, compilation aborted!
Stack dump:
0.      Program arguments: llvm-link -o /tmp/foo.bc /tmp/bz.ll /tmp/bar.ll 
1.      Running pass 'Function Pass Manager' on module '/tmp/bz.ll'.
2.      Running pass 'Module Verifier' on function '@bug_a'

I don't understand the error message, but I've experimented with reducing the
test case to a few lines of LLVM assembly:

first file:
%struct.bug_type = type opaque
declare i32 @bug_a(%struct.bug_type*)
declare i32 @bug_b(%struct.bug_type*)

second file:
%struct.bug_type = type { %struct.bug_type* }
%bar = type { i32 }
define i32 @bug_a(%struct.bug_type* %fp) nounwind uwtable {
  %d_stream = getelementptr inbounds %struct.bug_type* %fp, i64 0, i32 0
  ret i32 0
define i32 @bug_b(%bar* %a) nounwind uwtable {
  ret i32 0

Command to reproduce: llvm-link -o foo.bc first.ll second.ll

The type mismatch is intentional, it may or may not have been in my original
clang-generated bitcode files, I didn't check; the point is that this error is
not noticed, instead it complains about the function bug_a that is (or seems)

The problem disappears when any detail is changed in the file, and it
disappears when the reverse argument order in the llvm-link command is used.

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