[LLVMbugs] [Bug 13475] New: miscompile in unzip

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 27 17:53:10 PDT 2012


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

             Bug #: 13475
           Summary: miscompile in unzip
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This is hand-reduced out of unzip's huft_build() function:

define i32 @test(i32 %j.4, i32 %w, i32 %el) {
  %tmp532 = add i32 %j.4, %w
  %tmp533 = icmp ugt i32 %tmp532, %el
  %tmp534 = icmp ult i32 %w, %el
  %or.cond = and i1 %tmp533, %tmp534
  %tmp535 = sub i32 %el, %w
  %j.5 = select i1 %or.cond, i32 %tmp535, i32 %j.4
  ret i32 %j.5
}

if called with (8, 0, 7) it produces different values when built by llc -O0 vs
-O1. Here's annotated -O1 assembly:

        movl    %edx, %eax
        subl    %esi, %eax
        sbbb    %cl, %cl   ;; %el > %w, should be %el < %w
        addl    %edi, %esi
        cmpl    %edx, %esi
        seta    %dl
        testb   %dl, %cl
        cmovel  %edi, %eax
        ret

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