public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828
@ 2023-02-24 16:37 Hans-Peter Nilsson
  2023-02-27  7:33 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Hans-Peter Nilsson @ 2023-02-24 16:37 UTC (permalink / raw)
  To: gcc-patches

Ok to commit?

I suggest that when committed I'll also set the bugzilla
entry in SUSPENDED mode, as opposed to RESOLVED.  I mean,
the issue isn't really solved; that'd be a patch improving
pointer tracking across ivopts.

-- >8 --
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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/Wuse-after-free-2.c b/gcc/testsuite/gcc.dg/Wuse-after-free-2.c
index 68ec75845cec..ebc051690db5 100644
--- a/gcc/testsuite/gcc.dg/Wuse-after-free-2.c
+++ b/gcc/testsuite/gcc.dg/Wuse-after-free-2.c
@@ -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;
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828
  2023-02-24 16:37 [PATCH] testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828 Hans-Peter Nilsson
@ 2023-02-27  7:33 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-02-27  7:33 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

On Fri, Feb 24, 2023 at 5:38 PM Hans-Peter Nilsson via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Ok to commit?
>
> I suggest that when committed I'll also set the bugzilla
> entry in SUSPENDED mode, as opposed to RESOLVED.  I mean,
> the issue isn't really solved; that'd be a patch improving
> pointer tracking across ivopts.

OK.

Thanks,
Richard.

> -- >8 --
> 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 | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.dg/Wuse-after-free-2.c b/gcc/testsuite/gcc.dg/Wuse-after-free-2.c
> index 68ec75845cec..ebc051690db5 100644
> --- a/gcc/testsuite/gcc.dg/Wuse-after-free-2.c
> +++ b/gcc/testsuite/gcc.dg/Wuse-after-free-2.c
> @@ -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;
>
> --
> 2.30.2
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-27  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 16:37 [PATCH] testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828 Hans-Peter Nilsson
2023-02-27  7:33 ` Richard Biener

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).