This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix ICE during out-of-SSA
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Jul 2012 16:54:16 +0200
- Subject: [patch] Fix ICE during out-of-SSA
This is a regression present on mainline and 4.7 branch for targets using SJLJ
exceptions by default in Ada (e.g. ARM). The error message is:
Unable to coalesce ssa_names 2 and 20 which are marked as MUST COALESCE.
b1_2(ab) and b1_20(ab)
+===========================GNAT BUG DETECTED==============================+
| 4.8.0 20120716 (experimental) [trunk revision 189525] (x86_64-suse-linux) GCC
error:|
| SSA corruption |
| Error detected around p.adb:4:1
It's the usual case of overlapping live ranges for (ab) SSA names.
Tested on x86_64-suse-linux, OK for the mainline and 4.7 branch?
2012-07-18 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-forwprop.c (combine_conversions): Punt if the RHS of the
defining statement is a SSA name that occurs in abnormal PHIs.
2012-07-18 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/aggr20.ad[sb]: New test.
* gnat.dg/aggr20_pkg.ads: New helper.
--
Eric Botcazou
Index: tree-ssa-forwprop.c
===================================================================
--- tree-ssa-forwprop.c (revision 189525)
+++ tree-ssa-forwprop.c (working copy)
@@ -2584,6 +2584,11 @@ combine_conversions (gimple_stmt_iterato
unsigned int final_prec = TYPE_PRECISION (type);
int final_unsignedp = TYPE_UNSIGNED (type);
+ /* Don't propagate ssa names that occur in abnormal phis. */
+ if (TREE_CODE (defop0) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (defop0))
+ return 0;
+
/* In addition to the cases of two conversions in a row
handled below, if we are converting something to its own
type via an object of identical or wider precision, neither
-- { dg-do compile }
package body Aggr20 is
procedure Proc (R : out Rec3) is
begin
R := (Callback => Nil_Rec2);
end;
end Aggr20;
with Aggr20_Pkg; use Aggr20_Pkg;
with System;
package Aggr20 is
type Rec1 is record
Address : System.Address;
end record;
Nil_Rec1 : constant Rec1 := (Address => Default_Nil_Address);
type Rec2 is record
Callback : Rec1;
end record;
Nil_Rec2 : constant Rec2 := (Callback => Nil_Rec1);
type Rec3 is record
Callback : Rec2;
end record;
procedure Proc (R : out Rec3);
end Aggr20;
with System;
package Aggr20_Pkg is
procedure Proc;
Default_Nil_Address : constant System.Address := Proc'Address;
end Aggr20_Pkg;