[PATCH] testsuite: Fix up gcc.dg/torture/bitint-100.c test [PR124948]

Jakub Jelinek <[email protected]> Tue, 4 Aug 2026 17:54:16 +0200
Newsgroups gmane.comp.gcc.patches
Message-ID <anILKLIa4ma8ODY6@tucnak>
On Mon, Aug 03, 2026 at 01:56:35PM +0200, Torbjorn SVENSSON wrote:
> On 2026-08-03 13:54, Jakub Jelinek wrote:
> > On Mon, Aug 03, 2026 at 01:50:18PM +0200, Torbjorn SVENSSON wrote:
> > > This change introduces new failures for arm-none-eabi using thumb/arch=armv6s-m/cpu=cortex-m0/float-abi=soft/fpu=auto.
> > > 
> > > Testing torture/bitint-100.c,   -O0
> > > doing compile
> > > Executing on host: /build/install-native/bin/arm-none-eabi-gcc  /build/gcc_src/gcc/testsuite/gcc.dg/torture/bitint-100.c  -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto   -dumpbase "" -fdiagnostics-plain-output    -O0  -std=c23 -pedantic-errors      --specs=rdimon.specs -Wl,--start-group -lc -lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat  -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,gcc_tg.o -lm -T qemu.ld -o ./bitint-100.exe    (timeout = 800)
> > > spawn -ignore SIGHUP /build/install-native/bin/arm-none-eabi-gcc /build/gcc_src/gcc/testsuite/gcc.dg/torture/bitint-100.c -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -mfpu=auto -dumpbase  -fdiagnostics-plain-output -O0 -std=c23 -pedantic-errors --specs=rdimon.specs -Wl,--start-group -lc -lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,gcc_tg.o -lm -T qemu.ld -o ./bitint-100.exe
> > > pid is 1478576 -1478576
> > > /build/install-native/arm-none-eabi/bin/ld: /tmp/ccgSaSgH.o: in function `f1':
> > > bitint-100.c:(.text+0x5a): undefined reference to `__atomic_compare_exchange_4'
> > > /build/install-native/arm-none-eabi/bin/ld: (__atomic_compare_exchange_4): Unknown destination type (ARM/Thumb) in /tmp/ccgSaSgH.o
> > > bitint-100.c:(.text+0x5a): dangerous relocation: unsupported relocation
> > > /build/install-native/arm-none-eabi/bin/ld: /tmp/ccgSaSgH.o: in function `f2':
> > > bitint-100.c:(.text+0xa4): undefined reference to `__atomic_compare_exchange_4'
> > > /build/install-native/arm-none-eabi/bin/ld: (__atomic_compare_exchange_4): Unknown destination type (ARM/Thumb) in /tmp/ccgSaSgH.o
> > > bitint-100.c:(.text+0xa4): dangerous relocation: unsupported relocation
> > > ...
> > > collect2: error: ld returned 1 exit status
> > >   status 1
> > > compiler exited with status 1
> > > FAIL: gcc.dg/torture/bitint-100.c   -O0  (test for excess errors)
> > > 
> > > Same failure exist on both trunk and releases/gcc-16.
> > 
> > I thought gcc has been changed to add -latomic_asneeded by default.
> > Or is this because the linker doesn't support it in this configuration?
> To my knowledge, there is no atomic support for armv6s-m, but I can be wrong.

Most of the tests that are dg-do run and use atomics on int/long use
sync_int_long effective target.  Atomics on _BitInt(17), i.e. something
on all currently supported targets larger than short, probably need to be
treated the same.

Tested on x86_64-linux, ok for trunk?

2026-08-04  Jakub Jelinek  <[email protected]>

	PR target/124948
	* gcc.dg/torture/bitint-100.c: Require also sync_int_long effective
	target.

--- gcc/testsuite/gcc.dg/torture/bitint-100.c.jj	2026-07-14 10:43:39.057947557 +0200
+++ gcc/testsuite/gcc.dg/torture/bitint-100.c	2026-08-04 17:43:31.937193354 +0200
@@ -1,5 +1,5 @@
 /* PR target/124948 */
-/* { dg-do run { target bitint } } */
+/* { dg-do run { target { bitint && sync_int_long } } } */
 /* { dg-options "-std=c23 -pedantic-errors" } */
 /* { dg-skip-if "" { ! run_expensive_tests }  { "*" } { "-O0" "-O2" } } */
 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */


	Jakub