]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828
authorHans-Peter Nilsson <hp@axis.com>
Fri, 24 Feb 2023 16:22:02 +0000 (17:22 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Tue, 28 Feb 2023 01:04:20 +0000 (02:04 +0100)
For cris-elf before this patch, ever since it was added,
this test gets:

Running /x/gcc/testsuite/gcc.dg/dg.exp ...
FAIL: gcc.dg/Wuse-after-free-2.c  (test for warnings, line 115)
FAIL: gcc.dg/Wuse-after-free-2.c  (test for warnings, line 116)

and comparing tree dumps with a native x86_64-pc-linux-gnu
run shows a suspicious difference in the "180t.ivopts" dump.
Indeed -fno-ivopts makes the warning appear for cris-elf
too.  It was suggested to simply add -fno-ivopts to the
test-flags, like before -fno-tree-loop-distribute-patterns
was added; thus.

PR tree-optimization/108828
* gcc.dg/Wuse-after-free-2.c: Add -fno-ivopts.

gcc/testsuite/gcc.dg/Wuse-after-free-2.c

index 68ec75845cec58a80db49ba846de12d9e9ecc525..ebc051690db523d0633eb4b041698bb8148618fd 100644 (file)
@@ -1,6 +1,6 @@
 /* PR middle-end/104232 - spurious -Wuse-after-free after conditional free
    { dg-do compile }
-   { dg-options "-O2 -Wall -fno-tree-loop-distribute-patterns" }  */
+   { dg-options "-O2 -Wall -fno-tree-loop-distribute-patterns -fno-ivopts" }  */
 
 void free (void*);
 
@@ -108,7 +108,8 @@ int warn_cond_loop (char *p)
   char *q = p;
 
   /*  -fno-tree-loop-distribute-patterns ensures this does not get converted
-      into rawmemchr (making q and p unrelated).  */
+      into rawmemchr (making q and p unrelated).  Also, -fno-ivopts is required
+      for some targets, to not lose track of the pointer.  */
   while (*q)
     ++q;