[testsuite] : Use int128 effective target for gcc.dg/pr87874.c

Message ID CAFULd4ZUu-a0td-Qb65s-+h92KwX3TbY-4funr11V3kvEOZh7w@mail.gmail.com
State New
Headers show
Series
  • [testsuite] : Use int128 effective target for gcc.dg/pr87874.c
Related show

Commit Message

Uros Bizjak Nov. 7, 2018, 3:49 p.m.
2018-11-07  Uros Bizjak  <ubizjak@gmail.com>

    * gcc.dg/pr87874.c: Compile only for int128 effective target.

Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.

Uros.

Comments

Christophe Lyon Nov. 8, 2018, 12:29 p.m. | #1
On Wed, 7 Nov 2018 at 16:50, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> 2018-11-07  Uros Bizjak  <ubizjak@gmail.com>
>
>     * gcc.dg/pr87874.c: Compile only for int128 effective target.
>
> Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.
>

This doesn't work on aarch64 -mabi=ilp32:
/gcc/testsuite/gcc.dg/pr87874.c: In function 'em':
/gcc/testsuite/gcc.dg/pr87874.c:19:50: warning: conversion from 'long
long unsigned int' to 'long unsigned int' changes value from
'18446744073709551615' to '4294967295' [-Woverflow]
FAIL: gcc.dg/pr87874.c (test for excess errors)


> Uros.
Uros Bizjak Nov. 8, 2018, 2:11 p.m. | #2
On Thu, Nov 8, 2018 at 1:29 PM Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
> On Wed, 7 Nov 2018 at 16:50, Uros Bizjak <ubizjak@gmail.com> wrote:
> >
> > 2018-11-07  Uros Bizjak  <ubizjak@gmail.com>
> >
> >     * gcc.dg/pr87874.c: Compile only for int128 effective target.
> >
> > Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.
> >
>
> This doesn't work on aarch64 -mabi=ilp32:
> /gcc/testsuite/gcc.dg/pr87874.c: In function 'em':
> /gcc/testsuite/gcc.dg/pr87874.c:19:50: warning: conversion from 'long
> long unsigned int' to 'long unsigned int' changes value from
> '18446744073709551615' to '4294967295' [-Woverflow]
> FAIL: gcc.dg/pr87874.c (test for excess errors)

Does attached patch works for you?

Uros.
diff --git a/gcc/testsuite/gcc.dg/pr87874.c b/gcc/testsuite/gcc.dg/pr87874.c
index 1480a5e54937..80debe0b4806 100644
--- a/gcc/testsuite/gcc.dg/pr87874.c
+++ b/gcc/testsuite/gcc.dg/pr87874.c
@@ -16,7 +16,7 @@ em (int u5, int fo, int s7)
       if (es == 0)
         if (nb == *vk)
           {
-            const unsigned long int uint64_max = 18446744073709551615ul;
+            const unsigned long long int uint64_max = 18446744073709551615ull;
             __int128 ks = uint64_max / 2 + 1;
 
             while (s7 < 1)
Christophe Lyon Nov. 8, 2018, 3:31 p.m. | #3
On Thu, 8 Nov 2018 at 15:11, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Thu, Nov 8, 2018 at 1:29 PM Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> > On Wed, 7 Nov 2018 at 16:50, Uros Bizjak <ubizjak@gmail.com> wrote:
> > >
> > > 2018-11-07  Uros Bizjak  <ubizjak@gmail.com>
> > >
> > >     * gcc.dg/pr87874.c: Compile only for int128 effective target.
> > >
> > > Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.
> > >
> >
> > This doesn't work on aarch64 -mabi=ilp32:
> > /gcc/testsuite/gcc.dg/pr87874.c: In function 'em':
> > /gcc/testsuite/gcc.dg/pr87874.c:19:50: warning: conversion from 'long
> > long unsigned int' to 'long unsigned int' changes value from
> > '18446744073709551615' to '4294967295' [-Woverflow]
> > FAIL: gcc.dg/pr87874.c (test for excess errors)
>
> Does attached patch works for you?
>

Yes, thanks.

> Uros.

Patch

diff --git a/gcc/testsuite/gcc.dg/pr87874.c b/gcc/testsuite/gcc.dg/pr87874.c
index 3ab5dcf68ffb..1480a5e54937 100644
--- a/gcc/testsuite/gcc.dg/pr87874.c
+++ b/gcc/testsuite/gcc.dg/pr87874.c
@@ -1,9 +1,8 @@ 
-/* { dg-do compile } */
+/* { dg-do compile { target int128 } } */
 /* { dg-options "-g -O1 -fgcse -fno-dce -fno-tree-ccp -fno-tree-coalesce-vars -fno-tree-copy-prop -fno-tree-dce -fno-tree-dominator-opts -fno-tree-fre -fno-tree-loop-optimize -fno-tree-sink" } */
 
 int *vk;
 int m2;
-#if __SIZEOF_INT128__
 __int128 nb;
 
 void
@@ -32,4 +31,3 @@  em (int u5, int fo, int s7)
           }
     }
 }
-#endif