[LLVMbugs] [Bug 3617] New: llvm-gcc and clang can' t compile negative shift in O3 correctly
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Feb 18 20:15:08 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=3617
Summary: llvm-gcc and clang can't compile negative shift in O3
correctly
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Keywords: miscompilation
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: dodohack at gmail.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=2580)
--> (http://llvm.org/bugs/attachment.cgi?id=2580)
c source file
Source Code: shift.c
=============================
int func(int x, int y) {
x = x << y;
return x;
}
int main() {
int a = 120;
int b = -2;
printf("%d\n", func(a,b));
}
=============================
compiled with:
[hwalin at earth UnitTests]$ /opt/llvm-svn/obj/Debug/bin/clang -O=3 --emit-llvm
shift.c
=============================
[hwalin at earth UnitTests]$ cat shift.ll
; ModuleID = 'shift.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"
@.str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
define i32 @func(i32 %x, i32 %y) nounwind readnone {
entry:
%shl = shl i32 %x, %y ; <i32> [#uses=1]
ret i32 %shl
}
define i32 @main(...) nounwind {
entry:
%call2 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]*
@.str, i32 0, i32 0), i32 undef) ; <i32> [#uses=0]
ret i32 undef
}
declare i32 @printf(i8* nocapture, ...) nounwind
--
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