[cfe-dev] Showstopping behavior with atomic intrinsics

Abramo Bagnara abramo.bagnara at bugseng.com
Fri Sep 21 11:12:38 PDT 2012


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."?

-- 
Abramo Bagnara

BUGSENG srl - http://bugseng.com
mailto:abramo.bagnara at bugseng.com



More information about the cfe-dev mailing list