https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117642
Bug ID: 117642 Summary: __sync_lock_release() on 128bit integer does not behave according to documentation Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: documentation, wrong-code Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 59613 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59613&action=edit reduced testcase The documentation for the legacy __sync builtins: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html says: "GCC allows any scalar type that is 1, 2, 4 or 8 bytes in size other than the C type _Bool or the C++ type bool." - this is probably missing "... integer scalar type ...", as it can't be used on float types - it seems 16 byte types are supported as well (at least somewhere) "If a particular operation cannot be implemented on the target processor, a warning is generated and a call to an external function is generated." - as far as I can say, at least when using 128bit types, no warning is generated "The external function carries the same name as the built-in version, with an additional suffix ā_nā where n is the size of the data type." - __sync_lock_release() on __int128 does not generate any call, potentially generating broken code $ cat testcase.c __int128 t = 1; int main () { __sync_lock_release (&t); if (t != 0) __builtin_abort(); } $ x86_64-pc-linux-gnu-gcc testcase.c $ ./a.out Aborted $ x86_64-pc-linux-gnu-gcc testcase.c -mcx16 $ ./a.out