]> git.ipfire.org Git - thirdparty/gcc.git/commit
c-family: Yet another fix for _BitInt & __sync_* builtins [PR117641]
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Nov 2024 18:47:52 +0000 (19:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 9 Jan 2025 08:52:09 +0000 (09:52 +0100)
commit6b417daf0c4c486a754ee99ec07c85aa5d55c610
treea48c8037d81dc186f4bf0180f0d357af5d70db16
parent3190d6263c90f8e859b738a9b39f5e650a4a3a16
c-family: Yet another fix for _BitInt & __sync_* builtins [PR117641]

Sorry, the last patch only partially fixed the __sync_* ICEs with
_BitInt(128) on ia32.
Even for !fetch we need to error out and return 0.  I was afraid of
APIs like __atomic_exchange/__atomic_compare_exchange, those obviously
need to be supported even on _BitInt(128) on ia32, but they actually never
sync_resolve_size, they are handled by adding the size argument and using
the library version much earlier.
For fetch && !orig_format (i.e. __atomic_fetch_* etc.) we need to return -1
so that we handle it with a manualy __atomic_load +
__atomic_compare_exchange loop in the caller, all other cases should
be rejected.

2024-11-22  Jakub Jelinek  <jakub@redhat.com>

PR c/117641
* c-common.cc (sync_resolve_size): For size 16 with _BitInt
on targets where TImode isn't supported, use goto incompatible if
!fetch.

* gcc.dg/bitint-117.c: New test.

(cherry picked from commit 44984f7f7523f136085ba60fd107ba8309d4115b)
gcc/c-family/c-common.cc
gcc/testsuite/gcc.dg/bitint-117.c [new file with mode: 0644]