diff mbox series

[testsuite,applied] Fix gcc.dg/signbit-6.c for int != 32-bit targets

Message ID 9568b3e8-d080-41ac-b472-9c8e668a5167@gjlay.de
State New
Headers show
Series [testsuite,applied] Fix gcc.dg/signbit-6.c for int != 32-bit targets | expand

Commit Message

Georg-Johann Lay Oct. 2, 2024, 3:01 p.m. UTC
This test failed on int != 32-bit targets due to
a[0] = b[0] = INT_MIN instead of using INT32_MIN.

Johann

--

     testsuite/52641 - Fix gcc.dg/signbit-6.c for int != 32-bit targets.

             PR testsuite/52641
     gcc/testsuite/
             * gcc.dg/signbit-6.c (main): Initialize a[0] and b[0]
             with INT32_MIN (instead of with INT_MIN).

      {

Comments

Richard Biener Oct. 4, 2024, 6:39 a.m. UTC | #1
On Wed, Oct 2, 2024 at 5:01 PM Georg-Johann Lay <avr@gjlay.de> wrote:
>
> This test failed on int != 32-bit targets due to
> a[0] = b[0] = INT_MIN instead of using INT32_MIN.

OK.

Richard.

> Johann
>
> --
>
>      testsuite/52641 - Fix gcc.dg/signbit-6.c for int != 32-bit targets.
>
>              PR testsuite/52641
>      gcc/testsuite/
>              * gcc.dg/signbit-6.c (main): Initialize a[0] and b[0]
>              with INT32_MIN (instead of with INT_MIN).
>
> diff --git a/gcc/testsuite/gcc.dg/signbit-6.c
> b/gcc/testsuite/gcc.dg/signbit-6.c
> index da186624cfa..3a522893222 100644
> --- a/gcc/testsuite/gcc.dg/signbit-6.c
> +++ b/gcc/testsuite/gcc.dg/signbit-6.c
> @@ -38,8 +38,10 @@ int main ()
>     TYPE a[N];
>     TYPE b[N];
>
> -  a[0] = INT_MIN;
> -  b[0] = INT_MIN;
> +  /* This will invoke UB due to -INT32_MIN.  The test is supposed to pass
> +     because GCC is supposed to handle this UB case in a predictable
> way.  */
> +  a[0] = INT32_MIN;
> +  b[0] = INT32_MIN;
>
>     for (int i = 1; i < N; ++i)
>       {
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/signbit-6.c 
b/gcc/testsuite/gcc.dg/signbit-6.c
index da186624cfa..3a522893222 100644
--- a/gcc/testsuite/gcc.dg/signbit-6.c
+++ b/gcc/testsuite/gcc.dg/signbit-6.c
@@ -38,8 +38,10 @@  int main ()
    TYPE a[N];
    TYPE b[N];

-  a[0] = INT_MIN;
-  b[0] = INT_MIN;
+  /* This will invoke UB due to -INT32_MIN.  The test is supposed to pass
+     because GCC is supposed to handle this UB case in a predictable 
way.  */
+  a[0] = INT32_MIN;
+  b[0] = INT32_MIN;

    for (int i = 1; i < N; ++i)