[cfe-dev] Showstopping behavior with atomic intrinsics
Abramo Bagnara
abramo.bagnara at bugseng.com
Sat Sep 22 02:07:33 PDT 2012
Il 21/09/2012 23:35, Abramo Bagnara ha scritto:
> Il 21/09/2012 21:28, Benjamin Kramer ha scritto:
>>
>> On 21.09.2012, at 20:12, Abramo Bagnara <abramo.bagnara at bugseng.com> wrote:
>>
>>> Reduced testcase:
>>>
>>> $ cat z.c
>>> void f(volatile int* ptr, int val) {
>>> __sync_fetch_and_add_4(ptr, val);
>>> }
>>> void g(volatile int* ptr, int val) {
>>> __sync_fetch_and_add_4(ptr, val);
>>> }
>>> $ ~/llvm_trunk/Release+Asserts/bin/clang -c z.c
>>> z.c:5:3: error: call to '__sync_fetch_and_add_4' is ambiguous
>>> __sync_fetch_and_add_4(ptr, val);
>>> ^~~~~~~~~~~~~~~~~~~~~~
>>> z.c:2:3: note: candidate function
>>> __sync_fetch_and_add_4(ptr, val);
>>> ^
>>> z.c:2:3: note: candidate function
>>> 1 error generated.
>>>
>>> Removing g function the error disappears...
>>>
>>> As a side note I've noted this in Builtins.def:
>>>
>>> BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt")
>>>
>>> The signature seems wrong to me: should not it be "iD*i."?
>>
>> The signature looks right to me, the first "i" is the return type.
>
> Stupid me! Of course you are right. I've been misleaded by comparison
> with __sync_fetch_and_add signature.
>
>> There seems to be something wrong with the special handling code for __sync_ builtins in Sema.
Fixed in r164454.
--
Abramo Bagnara
BUGSENG srl - http://bugseng.com
mailto:abramo.bagnara at bugseng.com
More information about the cfe-dev
mailing list