[LLVMbugs] [Bug 3957] New: sync builtins should be overloaded
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Mon Apr 6 16:36:12 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=3957
Summary: sync builtins should be overloaded
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Semantic Analyzer
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: daniel at zuster.org
CC: llvmbugs at cs.uiuc.edu
The gcc atomic synchronization builtins are intended to be overloaded for 1, 2,
4, and 8 bytes. clang is always treating them as having int type.
--
cat t.c
char f0(char *a, char b) {
return __sync_fetch_and_add(a, b);
}
ddunbar at lordcrumb:tmp$ llvm-gcc -m32 -O3 -emit-llvm -S -o - t.c
; ModuleID = 't.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:128:128"
target triple = "i386-apple-darwin10.0"
define signext i8 @f0(i8* nocapture %a, i8 signext %b) nounwind ssp {
entry:
%0 = tail call i8 @llvm.atomic.load.add.i8.p0i8(i8* %a, i8 %b)
; <i8> [#uses=1]
ret i8 %0
}
declare i8 @llvm.atomic.load.add.i8.p0i8(i8* nocapture, i8) nounwind
ddunbar at lordcrumb:tmp$ clang -m32 -O3 -emit-llvm -S -o - t.c
t.c:2:31: warning: incompatible pointer types passing 'char *', expected 'int
*'
return __sync_fetch_and_add(a, b);
^
; ModuleID = 't.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:128:128"
target triple = "i386-apple-darwin10.0"
define signext i8 @f0(i8* nocapture %a, i8 signext %b) nounwind {
entry:
%conv = sext i8 %b to i32 ; <i32> [#uses=1]
%conv2 = bitcast i8* %a to i32* ; <i32*> [#uses=1]
%0 = tail call i32 @llvm.atomic.load.add.i32.p0i32(i32* %conv2, i32
%conv) ; <i32> [#uses=1]
%conv3 = trunc i32 %0 to i8 ; <i8> [#uses=1]
ret i8 %conv3
}
declare i32 @llvm.atomic.load.add.i32.p0i32(i32* nocapture, i32) nounwind
1 diagnostic generated.
--
--
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