testsuite: Fix up gcc.dg/pr126464.c test [PR126464]

Message ID anIGjU7Z10wLwWtB@tucnak
State New
Headers
Series testsuite: Fix up gcc.dg/pr126464.c test [PR126464] |

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:34 p.m. UTC
  On Tue, Aug 04, 2026 at 02:13:19PM +0200, Torbjorn SVENSSON wrote:
> This causes regression on most (all?) arm-none-eabi targets.
> /build/gcc_src/gcc/testsuite/gcc.dg/pr126464.c:56:3: warning: floating constant exceeds range of 'long double' [-Woverflow]

This patch guards it with preprocessor tests whether such floating point
constants are representable.

Tested on x86_64-linux, ok for trunk?

2026-08-04  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/126464
	* gcc.dg/pr126464.c: Guard uses of 1e300 with
	__DBL_MAX_10_EXP__ >= 301 and uses of 1e4000L with
	__LDBL_MAX_10_EXP__ >= 4001.



	Jakub
  

Comments

Andrea Pinski Aug. 4, 2026, 3:38 p.m. UTC | #1
On Tue, Aug 4, 2026 at 8:35 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Tue, Aug 04, 2026 at 02:13:19PM +0200, Torbjorn SVENSSON wrote:
> > This causes regression on most (all?) arm-none-eabi targets.
> > /build/gcc_src/gcc/testsuite/gcc.dg/pr126464.c:56:3: warning: floating constant exceeds range of 'long double' [-Woverflow]
>
> This patch guards it with preprocessor tests whether such floating point
> constants are representable.
>
> Tested on x86_64-linux, ok for trunk?
Ok.

>
> 2026-08-04  Jakub Jelinek  <jakub@redhat.com>
>
>         PR tree-optimization/126464
>         * gcc.dg/pr126464.c: Guard uses of 1e300 with
>         __DBL_MAX_10_EXP__ >= 301 and uses of 1e4000L with
>         __LDBL_MAX_10_EXP__ >= 4001.
>
> --- gcc/testsuite/gcc.dg/pr126464.c.jj  2026-07-30 09:56:33.400729346 +0200
> +++ gcc/testsuite/gcc.dg/pr126464.c     2026-08-04 17:31:18.458149999 +0200
> @@ -47,15 +47,19 @@ qux (long double x)
>  int
>  main ()
>  {
> +#if __DBL_MAX_10_EXP__ >= 301
>    if (!__builtin_isinf ((double) 1e300)
>        && __builtin_isinf ((float) 1e300)
>        && (foo (-1e300) != -5e299
>           || baz (1e300) != 5e299))
>      __builtin_abort ();
> +#endif
>
> +#if __LDBL_MAX_10_EXP__ >= 4001
>    if (!__builtin_isinf ((long double) 1e4000L)
>        && __builtin_isinf ((double) 1e4000L)
>        && (bar (1e4000L) != 5e3999L
>           || qux (-1e4000L) != -5e3999L))
>      __builtin_abort ();
> +#endif
>  }
>
>
>         Jakub
>
  
Torbjorn SVENSSON Aug. 5, 2026, 5:28 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:34, Jakub Jelinek wrote:
> On Tue, Aug 04, 2026 at 02:13:19PM +0200, Torbjorn SVENSSON wrote:
>> This causes regression on most (all?) arm-none-eabi targets.
>> /build/gcc_src/gcc/testsuite/gcc.dg/pr126464.c:56:3: warning: floating constant exceeds range of 'long double' [-Woverflow]
> 
> This patch guards it with preprocessor tests whether such floating point
> constants are representable.
> 
> Tested on x86_64-linux, ok for trunk?
> 
> 2026-08-04  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR tree-optimization/126464
> 	* gcc.dg/pr126464.c: Guard uses of 1e300 with
> 	__DBL_MAX_10_EXP__ >= 301 and uses of 1e4000L with
> 	__LDBL_MAX_10_EXP__ >= 4001.
> 
> --- gcc/testsuite/gcc.dg/pr126464.c.jj	2026-07-30 09:56:33.400729346 +0200
> +++ gcc/testsuite/gcc.dg/pr126464.c	2026-08-04 17:31:18.458149999 +0200
> @@ -47,15 +47,19 @@ qux (long double x)
>   int
>   main ()
>   {
> +#if __DBL_MAX_10_EXP__ >= 301
>     if (!__builtin_isinf ((double) 1e300)
>         && __builtin_isinf ((float) 1e300)
>         && (foo (-1e300) != -5e299
>   	  || baz (1e300) != 5e299))
>       __builtin_abort ();
> +#endif
>   
> +#if __LDBL_MAX_10_EXP__ >= 4001
>     if (!__builtin_isinf ((long double) 1e4000L)
>         && __builtin_isinf ((double) 1e4000L)
>         && (bar (1e4000L) != 5e3999L
>   	  || qux (-1e4000L) != -5e3999L))
>       __builtin_abort ();
> +#endif
>   }
> 
> 
> 	Jakub
>
  
Torbjorn SVENSSON Aug. 17, 2026, 8:23 a.m. UTC | #3
Hi again,

Any reason to not pick this change to releases/gcc-15?
The test is failing in r15-11477-gf3cf28e2da4d6b for arm-none-eabi.

Kind regards,
Torbjörn

On 2026-08-05 07:28, Torbjorn SVENSSON wrote:
> Hi Jakub,
> 
> I can confirm that this fixes the problem for arm-none-eabi.
> 
> Kind regards,
> Torbjörn
> 
> On 2026-08-04 17:34, Jakub Jelinek wrote:
>> On Tue, Aug 04, 2026 at 02:13:19PM +0200, Torbjorn SVENSSON wrote:
>>> This causes regression on most (all?) arm-none-eabi targets.
>>> /build/gcc_src/gcc/testsuite/gcc.dg/pr126464.c:56:3: warning: floating constant exceeds range of 'long double' [-Woverflow]
>>
>> This patch guards it with preprocessor tests whether such floating point
>> constants are representable.
>>
>> Tested on x86_64-linux, ok for trunk?
>>
>> 2026-08-04  Jakub Jelinek  <jakub@redhat.com>
>>
>>     PR tree-optimization/126464
>>     * gcc.dg/pr126464.c: Guard uses of 1e300 with
>>     __DBL_MAX_10_EXP__ >= 301 and uses of 1e4000L with
>>     __LDBL_MAX_10_EXP__ >= 4001.
>>
>> --- gcc/testsuite/gcc.dg/pr126464.c.jj    2026-07-30 09:56:33.400729346 +0200
>> +++ gcc/testsuite/gcc.dg/pr126464.c    2026-08-04 17:31:18.458149999 +0200
>> @@ -47,15 +47,19 @@ qux (long double x)
>>   int
>>   main ()
>>   {
>> +#if __DBL_MAX_10_EXP__ >= 301
>>     if (!__builtin_isinf ((double) 1e300)
>>         && __builtin_isinf ((float) 1e300)
>>         && (foo (-1e300) != -5e299
>>         || baz (1e300) != 5e299))
>>       __builtin_abort ();
>> +#endif
>> +#if __LDBL_MAX_10_EXP__ >= 4001
>>     if (!__builtin_isinf ((long double) 1e4000L)
>>         && __builtin_isinf ((double) 1e4000L)
>>         && (bar (1e4000L) != 5e3999L
>>         || qux (-1e4000L) != -5e3999L))
>>       __builtin_abort ();
>> +#endif
>>   }
>>
>>
>>     Jakub
>>
>
  
Jakub Jelinek Aug. 17, 2026, 8:27 a.m. UTC | #4
On Mon, Aug 17, 2026 at 10:23:20AM +0200, Torbjorn SVENSSON wrote:
> Any reason to not pick this change to releases/gcc-15?
> The test is failing in r15-11477-gf3cf28e2da4d6b for arm-none-eabi.

I usually do backporting in batches, so whenever I get to the next 15 batch,
it will be included.

	Jakub
  
Torbjorn SVENSSON Aug. 17, 2026, 8:28 a.m. UTC | #5
On 2026-08-17 10:27, Jakub Jelinek wrote:
> On Mon, Aug 17, 2026 at 10:23:20AM +0200, Torbjorn SVENSSON wrote:
>> Any reason to not pick this change to releases/gcc-15?
>> The test is failing in r15-11477-gf3cf28e2da4d6b for arm-none-eabi.
> 
> I usually do backporting in batches, so whenever I get to the next 15 batch,
> it will be included.

Ok, thanks!

Kind regards,
Torbjörn
  

Patch

--- gcc/testsuite/gcc.dg/pr126464.c.jj	2026-07-30 09:56:33.400729346 +0200
+++ gcc/testsuite/gcc.dg/pr126464.c	2026-08-04 17:31:18.458149999 +0200
@@ -47,15 +47,19 @@  qux (long double x)
 int
 main ()
 {
+#if __DBL_MAX_10_EXP__ >= 301
   if (!__builtin_isinf ((double) 1e300)
       && __builtin_isinf ((float) 1e300)
       && (foo (-1e300) != -5e299
 	  || baz (1e300) != 5e299))
     __builtin_abort ();
+#endif
 
+#if __LDBL_MAX_10_EXP__ >= 4001
   if (!__builtin_isinf ((long double) 1e4000L)
       && __builtin_isinf ((double) 1e4000L)
       && (bar (1e4000L) != 5e3999L
 	  || qux (-1e4000L) != -5e3999L))
     __builtin_abort ();
+#endif
 }