public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-ssa-dse: Fix up go.test/test/fixedbugs/issue16095.go miscompilation [PR100382]
@ 2021-05-03  8:56 Jakub Jelinek
  2021-05-03  9:51 ` Richard Biener
  2021-05-03 16:29 ` Ian Lance Taylor
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2021-05-03  8:56 UTC (permalink / raw)
  To: Richard Biener, Ian Lance Taylor, Eric Botcazou; +Cc: gcc-patches

Hi!

The new DCE code inside of tree DSE removes in -fnon-call-exceptions
go code a load from NULL pointer the testcase relies on throwing an
exception and so the test hangs.

The following patch just repeats a check that e.g. tree-ssa-dce.c
uses to prevent this.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2021-05-03  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/100382
	* tree-ssa-dse.c: Include tree-eh.h.
	(dse_dom_walker::before_dom_children): Don't remove stmts if
	stmt_unremovable_because_of_non_call_eh_p is true.

--- gcc/tree-ssa-dse.c.jj	2021-05-02 16:25:43.636266833 +0200
+++ gcc/tree-ssa-dse.c	2021-05-02 19:42:53.451320031 +0200
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.
 #include "builtins.h"
 #include "gimple-fold.h"
 #include "gimplify.h"
+#include "tree-eh.h"
 
 /* This file implements dead store elimination.
 
@@ -1193,7 +1194,8 @@ dse_dom_walker::before_dom_children (bas
 	  /* When we remove dead stores make sure to also delete trivially
 	     dead SSA defs.  */
 	  if (has_zero_uses (DEF_FROM_PTR (def_p))
-	      && !gimple_has_side_effects (stmt))
+	      && !gimple_has_side_effects (stmt)
+	      && !stmt_unremovable_because_of_non_call_eh_p (cfun, stmt))
 	    {
 	      if (dump_file && (dump_flags & TDF_DETAILS))
 		{

	Jakub


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

* Re: [PATCH] tree-ssa-dse: Fix up go.test/test/fixedbugs/issue16095.go miscompilation [PR100382]
  2021-05-03  8:56 [PATCH] tree-ssa-dse: Fix up go.test/test/fixedbugs/issue16095.go miscompilation [PR100382] Jakub Jelinek
@ 2021-05-03  9:51 ` Richard Biener
  2021-05-03 16:29 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Biener @ 2021-05-03  9:51 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ian Lance Taylor, Eric Botcazou, gcc-patches

On Mon, 3 May 2021, Jakub Jelinek wrote:

> Hi!
> 
> The new DCE code inside of tree DSE removes in -fnon-call-exceptions
> go code a load from NULL pointer the testcase relies on throwing an
> exception and so the test hangs.
> 
> The following patch just repeats a check that e.g. tree-ssa-dce.c
> uses to prevent this.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

Thanks,
Richard.

> 2021-05-03  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR tree-optimization/100382
> 	* tree-ssa-dse.c: Include tree-eh.h.
> 	(dse_dom_walker::before_dom_children): Don't remove stmts if
> 	stmt_unremovable_because_of_non_call_eh_p is true.
> 
> --- gcc/tree-ssa-dse.c.jj	2021-05-02 16:25:43.636266833 +0200
> +++ gcc/tree-ssa-dse.c	2021-05-02 19:42:53.451320031 +0200
> @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.
>  #include "builtins.h"
>  #include "gimple-fold.h"
>  #include "gimplify.h"
> +#include "tree-eh.h"
>  
>  /* This file implements dead store elimination.
>  
> @@ -1193,7 +1194,8 @@ dse_dom_walker::before_dom_children (bas
>  	  /* When we remove dead stores make sure to also delete trivially
>  	     dead SSA defs.  */
>  	  if (has_zero_uses (DEF_FROM_PTR (def_p))
> -	      && !gimple_has_side_effects (stmt))
> +	      && !gimple_has_side_effects (stmt)
> +	      && !stmt_unremovable_because_of_non_call_eh_p (cfun, stmt))
>  	    {
>  	      if (dump_file && (dump_flags & TDF_DETAILS))
>  		{
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

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

* Re: [PATCH] tree-ssa-dse: Fix up go.test/test/fixedbugs/issue16095.go miscompilation [PR100382]
  2021-05-03  8:56 [PATCH] tree-ssa-dse: Fix up go.test/test/fixedbugs/issue16095.go miscompilation [PR100382] Jakub Jelinek
  2021-05-03  9:51 ` Richard Biener
@ 2021-05-03 16:29 ` Ian Lance Taylor
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2021-05-03 16:29 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Biener, Eric Botcazou, gcc-patches

Jakub Jelinek <jakub@redhat.com> writes:

> The new DCE code inside of tree DSE removes in -fnon-call-exceptions
> go code a load from NULL pointer the testcase relies on throwing an
> exception and so the test hangs.
>
> The following patch just repeats a check that e.g. tree-ssa-dce.c
> uses to prevent this.

Thanks for tracking this down.

Ian

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

end of thread, other threads:[~2021-05-03 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03  8:56 [PATCH] tree-ssa-dse: Fix up go.test/test/fixedbugs/issue16095.go miscompilation [PR100382] Jakub Jelinek
2021-05-03  9:51 ` Richard Biener
2021-05-03 16:29 ` Ian Lance Taylor

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