diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index 367a9b07c872386715d9d89bddaf0d4ed63922ad..9254fb6c010a26e6ed9d6e2ec11c976f7eb31b67 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -7457,11 +7457,10 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params, bool fetch, size = tree_to_uhwi (TYPE_SIZE_UNIT (type)); if (size == 16 - && fetch && TREE_CODE (type) == BITINT_TYPE && !targetm.scalar_mode_supported_p (TImode)) { - if (!orig_format) + if (fetch && !orig_format) return -1; goto incompatible; } diff --git a/gcc/testsuite/gcc.dg/bitint-117.c b/gcc/testsuite/gcc.dg/bitint-117.c new file mode 100644 index 0000000000000000000000000000000000000000..16a76165d1e894850671ea14de1deb6891d2751a --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-117.c @@ -0,0 +1,13 @@ +/* PR c/117641 */ +/* { dg-do compile { target bitint575 } } */ +/* { dg-options "-std=c23" } */ + +void +foo (_BitInt(128) *b) +{ + __sync_add_and_fetch (b, 1); /* { dg-error "incompatible" "" { target { ! int128 } } } */ + __sync_val_compare_and_swap (b, 0, 1); /* { dg-error "incompatible" "" { target { ! int128 } } } */ + __sync_bool_compare_and_swap (b, 0, 1); /* { dg-error "incompatible" "" { target { ! int128 } } } */ + __sync_lock_test_and_set (b, 1); /* { dg-error "incompatible" "" { target { ! int128 } } } */ + __sync_lock_release (b); /* { dg-error "incompatible" "" { target { ! int128 } } } */ +}