<div dir="ltr">Hi All,<br><div><br></div><div>We are trying to override the compiler atomic builtin functions like </div><div><br></div><div>int  __sync_val_compare_and_swap( int *p,int x ,int y)<br></div><div>{<br>         return *p; //ignore the function semantics here<br>}<br><br></div><div>int main()<br>{<br>         int x = 0, y = 1;<br>   y = __sync_val_compare_and_swap(&x, x, y);<br><br>   return x + y;<br>}<br></div><div><br></div><div>clang throws the error like </div><div><br></div><div>test.c:1:6: error: cannot redeclare builtin function '__sync_val_compare_and_swap'<br>int  __sync_val_compare_and_swap( int *p,int x ,int y)<br>     ^<br>test.c:1:6: note: '__sync_val_compare_and_swap' is a builtin with type 'void ()'<br>test.c:1:6: error: definition of builtin function '__sync_val_compare_and_swap'<br>int  __sync_val_compare_and_swap( int *p,int x ,int y)</div><div><br></div><div>But GCC compiles it and we think that GCC is right here unlike clang.</div><div><br></div><div>We would like to hear from the community view on this.</div><div><br></div><div>Thank you </div><div>~Umesh </div><div><br></div><div>  <br></div></div>