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

Message ID anILKLIa4ma8ODY6@tucnak
State New
Headers
Series testsuite: Fix up gcc.dg/torture/bitint-100.c test [PR124948] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap success Build passed
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Jakub Jelinek Aug. 4, 2026, 3:54 p.m. UTC
  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  <jakub@redhat.com>

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



	Jakub
  

Comments

Andrea Pinski Aug. 4, 2026, 3:58 p.m. UTC | #1
On Tue, Aug 4, 2026 at 8:54 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> 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?

Ok.


>
> 2026-08-04  Jakub Jelinek  <jakub@redhat.com>
>
>         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
>
  
Torbjorn SVENSSON Aug. 5, 2026, 5:29 a.m. UTC | #2
Hi Jakub,

I can confirm that this fixes the problem for arm-none-eabi.

Kind regards,
Torbjörn


On 2026-08-04 17:54, Jakub Jelinek wrote:
> 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  <jakub@redhat.com>
> 
> 	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
>
  

Patch

--- 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" } { "" } } */