[llvm-bugs] [Bug 34821] New: __sync_and_fetch_min/max/umin/umax builtins don't support different size overloads
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 3 15:45:19 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34821
Bug ID: 34821
Summary: __sync_and_fetch_min/max/umin/umax builtins don't
support different size overloads
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: gberry at codeaurora.org
CC: llvm-bugs at lists.llvm.org
llvm/docs/Atomics.rst lists these builtins as being supported for sizes of 1,
2, 4, 8, or 16, but that doesn't seem to be the case.
For example, on aarch64 where long is 8 bytes:
long atomic64(void) {
long old;
long val = 1;
unsigned long uval = 1;
old = __sync_fetch_and_min(&val, 3);
old = __sync_fetch_and_max(&val, 4);
old = __sync_fetch_and_umin(&uval, 5);
old = __sync_fetch_and_umax(&uval, 6);
old = __sync_fetch_and_min_8(&val, 3);
old = __sync_fetch_and_max_8(&val, 4);
old = __sync_fetch_and_umin_8(&uval, 5);
old = __sync_fetch_and_umax_8(&uval, 6);
return old;
}
generates the following warnings and generates a 32-bit atomic op in the first
case and a function call to an unknown function in the second:
atomic.c:19:30: warning: incompatible pointer types passing 'long *' to
parameter of type 'volatile int *'
[-Wincompatible-pointer-types]
old = __sync_fetch_and_min(&val, 3);
^~~~
atomic.c:20:30: warning: incompatible pointer types passing 'long *' to
parameter of type 'volatile int *'
[-Wincompatible-pointer-types]
old = __sync_fetch_and_max(&val, 4);
^~~~
atomic.c:21:31: warning: incompatible pointer types passing 'unsigned long *'
to parameter of type
'volatile unsigned int *' [-Wincompatible-pointer-types]
old = __sync_fetch_and_umin(&uval, 5);
^~~~~
atomic.c:22:31: warning: incompatible pointer types passing 'unsigned long *'
to parameter of type
'volatile unsigned int *' [-Wincompatible-pointer-types]
old = __sync_fetch_and_umax(&uval, 6);
^~~~~
atomic.c:24:9: warning: implicit declaration of function
'__sync_fetch_and_min_8' is invalid in C99
[-Wimplicit-function-declaration]
old = __sync_fetch_and_min_8(&val, 3);
^
atomic.c:25:9: warning: implicit declaration of function
'__sync_fetch_and_max_8' is invalid in C99
[-Wimplicit-function-declaration]
old = __sync_fetch_and_max_8(&val, 4);
^
atomic.c:26:9: warning: implicit declaration of function
'__sync_fetch_and_umin_8' is invalid in C99
[-Wimplicit-function-declaration]
old = __sync_fetch_and_umin_8(&uval, 5);
^
atomic.c:27:9: warning: implicit declaration of function
'__sync_fetch_and_umax_8' is invalid in C99
[-Wimplicit-function-declaration]
old = __sync_fetch_and_umax_8(&uval, 6);
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171003/731e2cf5/attachment.html>
More information about the llvm-bugs
mailing list