diff mbox

Fix ICE in insert_clobber_before_stack_restore

Message ID 3901187.y1yesbvXdO@polaris
State New
Headers show

Commit Message

Eric Botcazou Sept. 18, 2013, 11:21 a.m. UTC
Hi,

this is a regression present on mainline and 4.8 branch (and latent on the 4.7 
branch), which is visible with the attached Ada testcase for targets using the 
SJLJ exception scheme:

eric@polaris:~/gnat/bugs/M823-029> ~/build/gcc-4_8-branch/native/gcc/gnat1 -
quiet p.adb -O2
+===========================GNAT BUG DETECTED==============================+
| 4.8.2 20130916 (prerelease) [gcc-4_8-branch revision 202625] (x86_64-suse-
linux) GCC error:|
| in insert_clobber_before_stack_restore, at tree-ssa-ccp.c:1711           |
| Error detected around p.adb:5:3            

The problem is that insert_clobber_before_stack_restore recurses on PHI nodes, 
but stops on copy assignment statements, which appears to be just an oversight 
in this new function.  The SSA_NAMEs have SSA_NAME_OCCURS_IN_ABNORMAL_PHI here 
(because of the SJLJ exception scheme), which very likely explains the copy 
assignment statement.

Tested on x86_64-suse-linux, OK for mainline and 4.8 branch?  What about the 
4.7 branch?


2013-09-18  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy
	assignment statements.


2013-09-18  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/opt28.ad[sb]: New test.
	* gnat.dg/opt28_pkg.ads: New helper.

Comments

Richard Biener Sept. 23, 2013, 11:33 a.m. UTC | #1
On Wed, Sep 18, 2013 at 1:21 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is a regression present on mainline and 4.8 branch (and latent on the 4.7
> branch), which is visible with the attached Ada testcase for targets using the
> SJLJ exception scheme:
>
> eric@polaris:~/gnat/bugs/M823-029> ~/build/gcc-4_8-branch/native/gcc/gnat1 -
> quiet p.adb -O2
> +===========================GNAT BUG DETECTED==============================+
> | 4.8.2 20130916 (prerelease) [gcc-4_8-branch revision 202625] (x86_64-suse-
> linux) GCC error:|
> | in insert_clobber_before_stack_restore, at tree-ssa-ccp.c:1711           |
> | Error detected around p.adb:5:3
>
> The problem is that insert_clobber_before_stack_restore recurses on PHI nodes,
> but stops on copy assignment statements, which appears to be just an oversight
> in this new function.  The SSA_NAMEs have SSA_NAME_OCCURS_IN_ABNORMAL_PHI here
> (because of the SJLJ exception scheme), which very likely explains the copy
> assignment statement.
>
> Tested on x86_64-suse-linux, OK for mainline and 4.8 branch?  What about the
> 4.7 branch?

Ok.

Thanks,
Richard.

>
> 2013-09-18  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy
>         assignment statements.
>
>
> 2013-09-18  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * gnat.dg/opt28.ad[sb]: New test.
>         * gnat.dg/opt28_pkg.ads: New helper.
>
>
> --
> Eric Botcazou
diff mbox

Patch

Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c	(revision 202588)
+++ tree-ssa-ccp.c	(working copy)
@@ -1728,6 +1728,9 @@  insert_clobber_before_stack_restore (tre
 	insert_clobber_before_stack_restore (gimple_phi_result (stmt), var,
 					     visited);
       }
+    else if (gimple_assign_ssa_name_copy_p (stmt))
+      insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
+					   visited);
     else
       gcc_assert (is_gimple_debug (stmt));
 }