[LLVMbugs] [Bug 14965] New: Better error message for GEP with partially defined contents

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 16 08:26:17 PST 2013


             Bug #: 14965
           Summary: Better error message for GEP with partially defined
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dirkjan at ochtman.nl
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When trying to verify this IR:

%array$str = type { i64, [0 x %str] }

declare i8* @malloc(i64)

define i64 @foo(i64 %objsz) {
    %array.raw = call i8* @malloc(i64 %objsz);
    %array = bitcast i8* %array.raw to %array$str*
    %array.data = getelementptr %array$str* %array, i32 0, i32 1
    %ret = ptrtoint [0 x %str]* %array.data to i64
    ret i64 %ret

%str = type {i8*, i64}

It fails like this:

test.ll:50:30: error: invalid getelementptr indices
        %array.data = getelementptr %array$str* %array, i32 0, i32 1
1 error generated.

This appears to be due to %str being undefined where %array$str is defined. It
would be nice if this was reported with a better error message. It seems to me
that it could even be reported when processing the %array$str definition, but
there might be some subtleties that make that impossible.

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