[LLVMbugs] [Bug 4428] New: Assertion failed: (BitWidth == RHS.BitWidth && " Bit widths must be same for comparison"), function ult, file llvm/lib/ Support/APInt.cpp, line 492.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jun 22 03:35:29 PDT 2009


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

           Summary: Assertion failed: (BitWidth == RHS.BitWidth && "Bit
                    widths must be same for comparison"), function ult, file
                    llvm/lib/Support/APInt.cpp, line 492.
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: ed at 80386.nl
                CC: llvmbugs at cs.uiuc.edu
            Blocks: 3696


The following code causes Clang to crash when pulled through the loop
optimizer:

void
boom(void)
{
        char buf[64];
        char l;
        int zext;
        char *p, *pe;

        p = 1;
        pe = buf;
        zext = p - pe;
        l += zext;

        while (zext > 0 && p > buf) {
                p--;
                zext--;
        }

        while (l > 0 && p > buf);
}

; ModuleID = 'llvm-crash.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "x86_64-undermydesk-freebsd8.0"
@p = internal constant [1 x i8] c"\01", align 1         ; <[1 x i8]*> [#uses=1]

define i32 @crash(i8* nocapture %source) nounwind readonly {
entry:  
        %tmp1 = load i8* %source                ; <i8> [#uses=3]
        %idxprom = zext i8 %tmp1 to i64         ; <i64> [#uses=1]
        %arrayidx = getelementptr [1 x i8]* @p, i64 0, i64 %idxprom            
; <i8*> [#uses=1]
        %tmp2 = load i8* %arrayidx              ; <i8> [#uses=1]
        %cmp = icmp eq i8 %tmp2, 4              ; <i1> [#uses=1]
        br i1 %cmp, label %land.rhs, label %land.end

land.rhs:               ; preds = %entry
        %cmp7 = icmp sgt i8 %tmp1, -1           ; <i1> [#uses=1]
        br i1 %cmp7, label %land.end, label %lor.rhs

lor.rhs:                ; preds = %land.rhs
        %cmp12 = icmp ugt i8 %tmp1, -65         ; <i1> [#uses=1]
        %phitmp = zext i1 %cmp12 to i32         ; <i32> [#uses=1]
        ret i32 %phitmp

land.end:               ; preds = %land.rhs, %entry
        %0 = phi i32 [ 0, %entry ], [ 1, %land.rhs ]            ; <i32>
[#uses=1]
        ret i32 %0
}

cc: warning: argument unused during compilation: '-c'
llvm-crash.c:9:4: warning: incompatible integer to pointer conversion assigning
'int', expected 'char *'
        p = 1;
          ^ ~
Assertion failed: (BitWidth == RHS.BitWidth && "Bit widths must be same for
comparison"), function ult, file llvm/lib/Support/APInt.cpp, line 492.
Stack dump:
0.      Program arguments: clang-cc -triple x86_64-undermydesk-freebsd8.0 -S
-disable-free -main-file-name llvm-crash.c --relocation-model static
--disable-fp-elim --unwind-tables=1 --mcpu=x86-64 --fmath-errno=1 -O2
-std=gnu89 -fdiagnostics-show-option -o llvm-crash -x c llvm-crash.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Loop Pass Manager' on function '@boom'
4.      Running pass 'Loop Strength Reduction' on basic block '%while.cond'


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