> 2014-06-13  Richard Biener  <rguent...@suse.de>
> 
>       * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
>       Rewrite to propagate the VN result into all uses where
>       possible and to remove stmts becoming dead because of that.
>       (eliminate): Generalize stmt removal handling, remove in
>       reverse dominator order to support proper debug stmt
>       generation.  Update stmts before removing stmts.
>       * tree-ssa-propagate.c (propagate_tree_value): Remove
>       bogus assert.

This breaks Ada bootstrap with non-standard build options (-gnatpgn).  I have 
attached a reduced testcase, but you need the Ada SJLJ scheme to see it so the 
following procedure can be used:

 1. Put p.ad[bs] in $(BUILDDIR)
 2. Do "gcc/gnat1 -quiet p.adb -I $(SRCDIR)/gcc/ada -I gcc/ada -O2 -gnatn"

eric@polaris:~/build/gcc/native> gcc/gnat1 -quiet p.adb -I ~/svn/gcc/gcc/ada -
I gcc/ada -O2 -gnatn
+===========================GNAT BUG DETECTED==============================+
| 4.10.0 20140614 (experimental) [trunk revision 211664] (x86_64-suse-linux) 
GCC error:|
| in forward_edge_to_pdom, at tree-ssa-dce.c:1042                          |
| Error detected around /home/eric/svn/gcc/gcc/ada/sinfo.adb:6010:8        |

-- 
Eric Botcazou
with Atree;    use Atree;
with Einfo;    use Einfo;
with Elists;   use Elists;
with Exp_Ch6;  use Exp_Ch6;
with Nmake;    use Nmake;
with Opt;      use Opt;
with Rtsfind;  use Rtsfind;
with Sem_Aux;  use Sem_Aux;
with Sinfo;    use Sinfo;
with Tbuild;   use Tbuild;

package body P is

   procedure Expand_Allocator_Expression (N : Node_Id) is
      Loc    : constant Source_Ptr := Sloc (N);
      Exp    : constant Node_Id    := Expression (Expression (N));

      procedure Apply_Accessibility_Check (Ref : Node_Id) is
      begin
         null;
      end Apply_Accessibility_Check;

      Indic         : constant Node_Id   := Subtype_Mark (Expression (N));
      T             : constant Entity_Id := Entity (Indic);
      Tag_Assign    : Node_Id;
      Temp          : Entity_Id;
      TagT : Entity_Id := Empty;
      TagR : Node_Id := Empty;

   begin

      if Ada_Version >= Ada_2012 and then Nkind (Exp) = N_Function_Call then
         declare
            Subp : Entity_Id;
         begin
            if Nkind (Name (Exp)) = N_Explicit_Dereference then
               Subp := Designated_Type (Etype (Prefix (Name (Exp))));
            else
               Subp := Entity (Name (Exp));
            end if;
         end;
      end if;

      if Is_Tagged_Type (T) then

         if Ada_Version >= Ada_2005 then
            Make_Build_In_Place_Call_In_Allocator (N, Exp);
            Apply_Accessibility_Check (N);
            return;
         end if;

         Temp := Make_Temporary (Loc, 'P', N);

         if Is_Private_Type (T)
           and then Is_Tagged_Type (Underlying_Type (T))
         then
            TagT := Underlying_Type (T);
            TagR :=
              Unchecked_Convert_To (Underlying_Type (T),
                Make_Explicit_Dereference (Loc,
                  Prefix => New_Occurrence_Of (Temp, Loc)));
         end if;

         if Present (TagT) then
            declare
               Full_T : constant Entity_Id := Underlying_Type (TagT);
            begin
               Tag_Assign :=
                 Make_Assignment_Statement (Loc,
                   Name       =>
                     Make_Selected_Component (Loc,
                       Prefix        => TagR,
                       Selector_Name =>
                         New_Occurrence_Of
                           (First_Tag_Component (Full_T), Loc)),

                   Expression =>
                     Unchecked_Convert_To (RTE (RE_Tag),
                       New_Occurrence_Of
                         (Elists.Node
                           (First_Elmt (Access_Disp_Table (Full_T))), Loc)));
            end;
         end if;

      end if;

   exception
      when RE_Not_Available => return;
   end;

end P;
with Types; use Types;

package P is

   procedure Expand_Allocator_Expression (N : Node_Id);

end P;

Reply via email to