public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1299] testsuite: Fix up pr106070.c test [PR106070]
@ 2022-06-27 13:36 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-06-27 13:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:00063459f683adcd92ada8325984e6b10e9f7a95

commit r13-1299-g00063459f683adcd92ada8325984e6b10e9f7a95
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jun 27 15:35:25 2022 +0200

    testsuite: Fix up pr106070.c test [PR106070]
    
    The test FAILs on 32-bit targets, because when unsigned long
    is 32-bit, (unsigned long) -1 isn't 0xffffffffffffffff.
    The options to fix this would be either using -1UL, or switch
    to unsigned long long and using -1ULL, I chose the latter because
    the test then FAILs in r13-1242 even on 32-bit targets.
    And while at it, some deobfuscation and formatting tweaks.
    
    2022-06-27  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/106070
            * gcc.dg/torture/pr106070.c: Use unsigned long long instead of
            unsigned long and -1ULL instead of 0xffffffffffffffff, deobcuscate
            and improve formatting.

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr106070.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/torture/pr106070.c b/gcc/testsuite/gcc.dg/torture/pr106070.c
index c36534f8a50..f031516cf0c 100644
--- a/gcc/testsuite/gcc.dg/torture/pr106070.c
+++ b/gcc/testsuite/gcc.dg/torture/pr106070.c
@@ -1,20 +1,22 @@
 /* { dg-do run } */
 
-unsigned int var_2 = 1;
-int var_4 = -1;
-int var_10 = 4;
-unsigned long arr_252;
-void __attribute__((noipa)) test() {
-  for (int a = 0; a < var_10; a += 2)
-    arr_252 = var_2 != (int)var_4 ? (unsigned long)var_4 : (unsigned long)var_2;
-}
+unsigned int a = 1;
+int b = -1;
+int c = 4;
+unsigned long long d;
 
-void test();
+void __attribute__((noipa))
+test (void)
+{
+  for (int i = 0; i < c; i += 2)
+    d = a != (int) b ? (unsigned long long) b : (unsigned long long) a;
+}
 
-int main()
+int
+main ()
 {
-  test();
-  if (arr_252 != 0xffffffffffffffff)
-    __builtin_abort();
+  test ();
+  if (d != -1ULL)
+    __builtin_abort ();
   return 0;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-27 13:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 13:36 [gcc r13-1299] testsuite: Fix up pr106070.c test [PR106070] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).