[LLVMbugs] [Bug 10938] New: wrong results from 'sgt'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 15 15:43:38 PDT 2011


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

           Summary: wrong results from 'sgt'
           Product: new-bugs
           Version: 2.8
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sudida21 at gmail.com
                CC: llvmbugs at cs.uiuc.edu


the following .bc code is run on Sparc
--------------------------------------------------------------------------------
; MduleID = '<stdin>'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32"
target triple = "sparc-unknown-linux"


@P = global i32 1
@dP = global i32 1

@.str = private constant [4 x i8] c"%d\0A\00", align 1

define i32 @main() nounwind {

entry:
    %. = load i32* @P, align 4
    %t1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds
([4 x i8]* @.str, i32 0, i32 0), i32 %. ) nounwind
    %d. = load i32* @dP, align 4   
    %t2 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds
([4 x i8]* @.str, i32 0, i32 0), i32 %d. ) nounwind
    %0 = icmp sgt i32 %., 0
  %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([4
x i8]* @.str, i32 0, i32 0), i1 %0 ) nounwind
    %2 = icmp sgt i32 %d., 0
    %3 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds
([4 x i8]* @.str, i32 0, i32 0), i1 %2 ) nounwind
    %t3 = icmp eq i32 %d., %d.
    %t4 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds
([4 x i8]* @.str, i32 0, i32 0), i1 %t3 ) nounwind
    %4 = icmp sgt i32 1, 0
    %5 = icmp sgt i32 1, 0
    %6 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds
([4 x i8]* @.str, i32 0, i32 0), i1 %4 ) nounwind
    %7 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds
([4 x i8]* @.str, i32 0, i32 0), i1 %5 ) nounwind
  ret i32 undef
}

declare i32 @printf(i8* nocapture, ...) nounwind
---------------------------------------------------------------------------

which produces 

1
1
0
0
1
1
1

The results are wrong. They should be all ones.

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