Re: [PATCH 4/7] testsuite: request IEEE options for tests relying on NaN and infinity

Andrea Pinski <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <CALvbMcD0oMWjRoqhWFh8tbbdvwN5QtBxCJuhap4=3joGKv=46Q@mail.gmail.com>
On Fri, Aug 14, 2026 at 12:33 PM Matt Turner <[email protected]> wrote:
>
> These tests feed NaNs or infinities through floating-point comparisons.
> Alpha only generates IEEE-conformant code with -mieee: without it GCC emits
> cmpteq rather than cmpteq/su, and an invalid-operation trap on a non-finite
> operand is not software-completable, so the program dies with SIGFPE.
>
> Use dg-add-options ieee, which adds -mieee on alpha and sh, rather than
> marking the tests as expected failures.  The compiler behaves as documented
> and the tests check something meaningful once IEEE semantics are requested.
>
> gcc/testsuite/ChangeLog:
>
>         * g++.dg/opt/pr94589-6.C: Add dg-add-options ieee.
>         * g++.dg/torture/pr116120-2.C: Likewise.
>         * gcc.c-torture/execute/20190901-1.c: Likewise.
>         * gcc.dg/pr108447.c: Likewise.
>         * gcc.dg/pr94589-6.c: Likewise.
>         * gcc.dg/torture/pr126464.c: Likewise.
>         * gcc.dg/torture/pr126576.c: Likewise.

Ok.


> ---
>  gcc/testsuite/g++.dg/opt/pr94589-6.C             | 1 +
>  gcc/testsuite/g++.dg/torture/pr116120-2.C        | 1 +
>  gcc/testsuite/gcc.c-torture/execute/20190901-1.c | 1 +
>  gcc/testsuite/gcc.dg/pr108447.c                  | 1 +
>  gcc/testsuite/gcc.dg/pr94589-6.c                 | 1 +
>  gcc/testsuite/gcc.dg/torture/pr126464.c          | 1 +
>  gcc/testsuite/gcc.dg/torture/pr126576.c          | 1 +
>  7 files changed, 7 insertions(+)
>
> diff --git ./gcc/testsuite/g++.dg/opt/pr94589-6.C ./gcc/testsuite/g++.dg/opt/pr94589-6.C
> index c5036c6f56a..49d205b057a 100644
> --- ./gcc/testsuite/g++.dg/opt/pr94589-6.C
> +++ ./gcc/testsuite/g++.dg/opt/pr94589-6.C
> @@ -1,6 +1,7 @@
>  // { dg-do run { target c++20 } }
>  // { dg-require-effective-target inf }
>  // { dg-options "-O2 -g" }
> +// { dg-add-options ieee }
>
>  #include "pr94589-5.C"
>
> diff --git ./gcc/testsuite/g++.dg/torture/pr116120-2.C ./gcc/testsuite/g++.dg/torture/pr116120-2.C
> index e9fee17a262..8715582578d 100644
> --- ./gcc/testsuite/g++.dg/torture/pr116120-2.C
> +++ ./gcc/testsuite/g++.dg/torture/pr116120-2.C
> @@ -1,4 +1,5 @@
>  // { dg-do run }
> +// { dg-add-options ieee }
>  // PR tree-optimization/116120
>
>  // The optimization for `(a ? x : y) == (b ? x : y)`
> diff --git ./gcc/testsuite/gcc.c-torture/execute/20190901-1.c ./gcc/testsuite/gcc.c-torture/execute/20190901-1.c
> index 2345e51896f..08869092c78 100644
> --- ./gcc/testsuite/gcc.c-torture/execute/20190901-1.c
> +++ ./gcc/testsuite/gcc.c-torture/execute/20190901-1.c
> @@ -1,6 +1,7 @@
>  /* PR target/91472 */
>  /* Reported by John Paul Adrian Glaubitz <[email protected]> */
>  /* { dg-require-effective-target double64plus } */
> +/* { dg-add-options ieee } */
>
>  #if __SIZEOF_INT__ >= 4
>  typedef unsigned int gmp_uint_least32_t;
> diff --git ./gcc/testsuite/gcc.dg/pr108447.c ./gcc/testsuite/gcc.dg/pr108447.c
> index cfbaba6d0aa..e7e34ca24cf 100644
> --- ./gcc/testsuite/gcc.dg/pr108447.c
> +++ ./gcc/testsuite/gcc.dg/pr108447.c
> @@ -1,5 +1,6 @@
>  /* { dg-do run } */
>  /* { dg-options "-O2" } */
> +/* { dg-add-options ieee } */
>
>  __attribute__((noipa)) int
>  foo (float x, float y)
> diff --git ./gcc/testsuite/gcc.dg/pr94589-6.c ./gcc/testsuite/gcc.dg/pr94589-6.c
> index 3131ab4cfae..5828fce7f41 100644
> --- ./gcc/testsuite/gcc.dg/pr94589-6.c
> +++ ./gcc/testsuite/gcc.dg/pr94589-6.c
> @@ -1,5 +1,6 @@
>  /* { dg-do run { target inf } } */
>  /* { dg-options "-O2 -g" } */
> +/* { dg-add-options ieee } */
>
>  #include "pr94589-5.c"
>
> diff --git ./gcc/testsuite/gcc.dg/torture/pr126464.c ./gcc/testsuite/gcc.dg/torture/pr126464.c
> index c0dced1eedc..f433caefa8e 100644
> --- ./gcc/testsuite/gcc.dg/torture/pr126464.c
> +++ ./gcc/testsuite/gcc.dg/torture/pr126464.c
> @@ -1,5 +1,6 @@
>  /* PR tree-optimization/126464 */
>  /* { dg-do run } */
> +/* { dg-add-options ieee } */
>
>  #if __DBL_MANT_DIG__ == 53 && __DBL_MAX_10_EXP__ == 308 \
>      && __DBL_HAS_INFINITY__ && __FLT_EVAL_METHOD__ == 0
> diff --git ./gcc/testsuite/gcc.dg/torture/pr126576.c ./gcc/testsuite/gcc.dg/torture/pr126576.c
> index c94c7437035..a961f77552b 100644
> --- ./gcc/testsuite/gcc.dg/torture/pr126576.c
> +++ ./gcc/testsuite/gcc.dg/torture/pr126576.c
> @@ -1,5 +1,6 @@
>  /* PR tree-optimization/126576 */
>  /* { dg-do run } */
> +/* { dg-add-options ieee } */
>
>  #if __DBL_MANT_DIG__ == 53 && __DBL_MAX_10_EXP__ == 308 \
>      && __DBL_HAS_INFINITY__ && __FLT_EVAL_METHOD__ == 0
> --
> 2.54.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.