diff mbox series

[testsuite] : remove -fwrapv from signbit-5.c

Message ID patch-18754-tamar@arm.com
State New
Headers show
Series [testsuite] : remove -fwrapv from signbit-5.c | expand

Commit Message

Tamar Christina Sept. 3, 2024, 4:59 p.m. UTC
Hi All,

The meaning of the testcase was changed by passing it -fwrapv.  The reason for
the test failures on some platform was because the test was testing some
implementation defined behavior wrt INT_MIN in generic code.

Instead of using -fwrapv this just removes the border case from the test so
all the values now have a defined semantic.  It still relies on the handling of
shifting a negative value right, but that wasn't changed with -fwrapv anyway.

The -fwrapv case is being handled already by other testcases.

Regtested on aarch64-none-linux-gnu and no issues.

Ok for master?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	* gcc.dg/signbit-5.c: Remove -fwrapv and change INT_MIN to INT_MIN+1.

---




--

Comments

Richard Biener Sept. 3, 2024, 6:23 p.m. UTC | #1
> Am 03.09.2024 um 19:00 schrieb Tamar Christina <tamar.christina@arm.com>:
> 
> Hi All,
> 
> The meaning of the testcase was changed by passing it -fwrapv.  The reason for
> the test failures on some platform was because the test was testing some
> implementation defined behavior wrt INT_MIN in generic code.
> 
> Instead of using -fwrapv this just removes the border case from the test so
> all the values now have a defined semantic.  It still relies on the handling of
> shifting a negative value right, but that wasn't changed with -fwrapv anyway.
> 
> The -fwrapv case is being handled already by other testcases.
> 
> Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?

Ok

> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
>    * gcc.dg/signbit-5.c: Remove -fwrapv and change INT_MIN to INT_MIN+1.
> 
> ---
> diff --git a/gcc/testsuite/gcc.dg/signbit-5.c b/gcc/testsuite/gcc.dg/signbit-5.c
> index 2bca640f930b7d1799e995e86152a6d8d05ec2a0..e778f91ca33010029419b035cbb31eb742345c84 100644
> --- a/gcc/testsuite/gcc.dg/signbit-5.c
> +++ b/gcc/testsuite/gcc.dg/signbit-5.c
> @@ -1,5 +1,5 @@
> /* { dg-do run } */
> -/* { dg-options "-O3 -fwrapv" } */
> +/* { dg-options "-O3" } */
> 
> /* This test does not work when the truth type does not match vector type.  */
> /* { dg-additional-options "-march=armv8-a" { target aarch64_sve } } */
> @@ -44,8 +44,8 @@ int main ()
>   TYPE a[N];
>   TYPE b[N];
> 
> -  a[0] = INT_MIN;
> -  b[0] = INT_MIN;
> +  a[0] = INT_MIN+1;
> +  b[0] = INT_MIN+1;
> 
>   for (int i = 1; i < N; ++i)
>     {
> 
> 
> 
> 
> --
> <rb18754.patch>
Torbjörn SVENSSON Sept. 4, 2024, 7:13 a.m. UTC | #2
On 2024-09-03 20:23, Richard Biener wrote:
> 
> 
>> Am 03.09.2024 um 19:00 schrieb Tamar Christina <tamar.christina@arm.com>:
>>
>> Hi All,
>>
>> The meaning of the testcase was changed by passing it -fwrapv.  The reason for
>> the test failures on some platform was because the test was testing some
>> implementation defined behavior wrt INT_MIN in generic code.
>>
>> Instead of using -fwrapv this just removes the border case from the test so
>> all the values now have a defined semantic.  It still relies on the handling of
>> shifting a negative value right, but that wasn't changed with -fwrapv anyway.
>>
>> The -fwrapv case is being handled already by other testcases.
>>
>> Regtested on aarch64-none-linux-gnu and no issues.
>>
>> Ok for master?
> 
> Ok

As my patch (r14-10592) that was adding -fwrapv also got backported to 
releases/gcc-14, I assume that this patch should also be backported.

Do you want me to do the backport or will you manage it?

Kind regards,
Torbjörn

> 
>> Thanks,
>> Tamar
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * gcc.dg/signbit-5.c: Remove -fwrapv and change INT_MIN to INT_MIN+1.
>>
>> ---
>> diff --git a/gcc/testsuite/gcc.dg/signbit-5.c b/gcc/testsuite/gcc.dg/signbit-5.c
>> index 2bca640f930b7d1799e995e86152a6d8d05ec2a0..e778f91ca33010029419b035cbb31eb742345c84 100644
>> --- a/gcc/testsuite/gcc.dg/signbit-5.c
>> +++ b/gcc/testsuite/gcc.dg/signbit-5.c
>> @@ -1,5 +1,5 @@
>> /* { dg-do run } */
>> -/* { dg-options "-O3 -fwrapv" } */
>> +/* { dg-options "-O3" } */
>>
>> /* This test does not work when the truth type does not match vector type.  */
>> /* { dg-additional-options "-march=armv8-a" { target aarch64_sve } } */
>> @@ -44,8 +44,8 @@ int main ()
>>    TYPE a[N];
>>    TYPE b[N];
>>
>> -  a[0] = INT_MIN;
>> -  b[0] = INT_MIN;
>> +  a[0] = INT_MIN+1;
>> +  b[0] = INT_MIN+1;
>>
>>    for (int i = 1; i < N; ++i)
>>      {
>>
>>
>>
>>
>> --
>> <rb18754.patch>
Jeff Law Sept. 4, 2024, 11:02 p.m. UTC | #3
On 9/4/24 1:13 AM, Torbjorn SVENSSON wrote:
> 
> 
> On 2024-09-03 20:23, Richard Biener wrote:
>>
>>
>>> Am 03.09.2024 um 19:00 schrieb Tamar Christina 
>>> <tamar.christina@arm.com>:
>>>
>>> Hi All,
>>>
>>> The meaning of the testcase was changed by passing it -fwrapv.  The 
>>> reason for
>>> the test failures on some platform was because the test was testing some
>>> implementation defined behavior wrt INT_MIN in generic code.
>>>
>>> Instead of using -fwrapv this just removes the border case from the 
>>> test so
>>> all the values now have a defined semantic.  It still relies on the 
>>> handling of
>>> shifting a negative value right, but that wasn't changed with -fwrapv 
>>> anyway.
>>>
>>> The -fwrapv case is being handled already by other testcases.
>>>
>>> Regtested on aarch64-none-linux-gnu and no issues.
>>>
>>> Ok for master?
>>
>> Ok
> 
> As my patch (r14-10592) that was adding -fwrapv also got backported to 
> releases/gcc-14, I assume that this patch should also be backported.
> 
> Do you want me to do the backport or will you manage it?
If you have commit privs, go right ahead ;-)

Jeff
Torbjörn SVENSSON Sept. 5, 2024, 9:45 a.m. UTC | #4
On 2024-09-05 01:02, Jeff Law wrote:
> 
> 
> On 9/4/24 1:13 AM, Torbjorn SVENSSON wrote:
>>
>>
>> On 2024-09-03 20:23, Richard Biener wrote:
>>>
>>>
>>>> Am 03.09.2024 um 19:00 schrieb Tamar Christina 
>>>> <tamar.christina@arm.com>:
>>>>
>>>> Hi All,
>>>>
>>>> The meaning of the testcase was changed by passing it -fwrapv.  The 
>>>> reason for
>>>> the test failures on some platform was because the test was testing 
>>>> some
>>>> implementation defined behavior wrt INT_MIN in generic code.
>>>>
>>>> Instead of using -fwrapv this just removes the border case from the 
>>>> test so
>>>> all the values now have a defined semantic.  It still relies on the 
>>>> handling of
>>>> shifting a negative value right, but that wasn't changed with - 
>>>> fwrapv anyway.
>>>>
>>>> The -fwrapv case is being handled already by other testcases.
>>>>
>>>> Regtested on aarch64-none-linux-gnu and no issues.
>>>>
>>>> Ok for master?
>>>
>>> Ok
>>
>> As my patch (r14-10592) that was adding -fwrapv also got backported to 
>> releases/gcc-14, I assume that this patch should also be backported.
>>
>> Do you want me to do the backport or will you manage it?
> If you have commit privs, go right ahead ;-)

Backported as r14-10643.

> 
> Jeff
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/signbit-5.c b/gcc/testsuite/gcc.dg/signbit-5.c
index 2bca640f930b7d1799e995e86152a6d8d05ec2a0..e778f91ca33010029419b035cbb31eb742345c84 100644
--- a/gcc/testsuite/gcc.dg/signbit-5.c
+++ b/gcc/testsuite/gcc.dg/signbit-5.c
@@ -1,5 +1,5 @@ 
 /* { dg-do run } */
-/* { dg-options "-O3 -fwrapv" } */
+/* { dg-options "-O3" } */
 
 /* This test does not work when the truth type does not match vector type.  */
 /* { dg-additional-options "-march=armv8-a" { target aarch64_sve } } */
@@ -44,8 +44,8 @@  int main ()
   TYPE a[N];
   TYPE b[N];
 
-  a[0] = INT_MIN;
-  b[0] = INT_MIN;
+  a[0] = INT_MIN+1;
+  b[0] = INT_MIN+1;
 
   for (int i = 1; i < N; ++i)
     {