On Sat, Sep 07, 2024 at 01:58:46PM -0400, Andrew MacLeod wrote:
The test as committed without the tree-vrp.cc change only FAILs with
FAIL: gcc.dg/pr116588.c scan-tree-dump-not vrp2 "0 != 0"
The DEBUG code in there was just to make it easier to debug, but doesn't
actually fail when the test is miscompiled.
We don't need such debugging code in simple tests like that, but it is
useful if they abort when miscompiled.

With this patch without the tree-vrp.cc change I see
FAIL: gcc.dg/pr116588.c execution test
FAIL: gcc.dg/pr116588.c scan-tree-dump-not vrp2 "0 != 0"
and with it it passes.

Tested on x86_64-linux with
make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} dg.exp=pr116588.c'
and committed to trunk as obvious.

2024-09-09  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/116588
        * gcc.dg/pr116588.c: Remove -DDEBUG from dg-options.
        (main): Remove debugging code and simplify.

--- gcc/testsuite/gcc.dg/pr116588.c.jj  2024-09-09 09:27:39.155082488 +0200
+++ gcc/testsuite/gcc.dg/pr116588.c     2024-09-09 09:31:37.951970837 +0200
@@ -1,7 +1,7 @@
 /* PR tree-optimization/116588 */
 /* { dg-do run { target bitint575 } } */
 /* { dg-require-effective-target int128 } */
-/* { dg-options "-O2 -fno-vect-cost-model -fno-tree-dominator-opts 
-fno-tree-fre --param=vrp-block-limit=0  -DDEBUG -fdump-tree-vrp2-details" } */
+/* { dg-options "-O2 -fno-vect-cost-model -fno-tree-dominator-opts 
-fno-tree-fre --param=vrp-block-limit=0 -fdump-tree-vrp2-details" } */
 
 int a;
 __int128 b, c;
@@ -18,15 +18,8 @@ foo (_BitInt (129) e)
 int
 main ()
 {
-  __int128 x = foo (0);
-#ifdef DEBUG
-  for (unsigned i = 0; i < sizeof (x); i++)
-    __builtin_printf ("%02x", i[(volatile unsigned char *) &x]);
-  __builtin_printf("\n");
-#else
-  if (x)
-    __builtin_abort();
-#endif
+  if (foo (0))
+    __builtin_abort ();
 }
 
 /* { dg-final { scan-tree-dump-not "0 != 0" "vrp2" } } */


        Jakub

Reply via email to