decl.c (gnat_to_gnu_entity): Do not set TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Do not set
	TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.

From-SVN: r165925
This commit is contained in:
Eric Botcazou 2010-10-25 17:26:04 +00:00 committed by Eric Botcazou
parent 570f469171
commit 8c211c83bb
8 changed files with 105 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2010-10-25 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Do not set
TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.
2010-10-25 Jose Ruiz <ruiz@adacore.com>
* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for powerpc-linux):

View File

@ -1942,7 +1942,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_template_reference
= build_unary_op (INDIRECT_REF, gnu_template_type, tem);
TREE_READONLY (gnu_template_reference) = 1;
TREE_THIS_NOTRAP (gnu_template_reference) = 1;
/* Now create the GCC type for each index and add the fields for that
index to the template. */

View File

@ -1,3 +1,9 @@
2010-10-25 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/loop_optimization8.adb: New test.
* gnat.dg/loop_optimization8_pkg1.ad[sb]: New helper.
* gnat.dg/loop_optimization8_pkg2.ad[sb]: Likewise.
2010-10-25 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/in_out_parameter2.adb: New test.

View File

@ -0,0 +1,30 @@
-- { dg-do run }
-- { dg-options "-O -gnatn" }
with Loop_Optimization8_Pkg1;
procedure Loop_Optimization8 is
Data : Loop_Optimization8_Pkg1.T;
procedure Check_1 (N : in Natural) is
begin
if N /= 0 then
for I in 1 .. Data.Last loop
declare
F : constant Natural := Data.Elements (I);
begin
if F = N then
raise Program_Error;
end if;
end;
end loop;
end if;
end;
procedure Check is new Loop_Optimization8_Pkg1.Iter (Check_1);
begin
Data := Loop_Optimization8_Pkg1.Empty;
Check;
end;

View File

@ -0,0 +1,15 @@
with Loop_Optimization8_Pkg2;
package body Loop_Optimization8_Pkg1 is
Data : Loop_Optimization8_Pkg2.T
:= new Loop_Optimization8_Pkg2.Obj_T'(Length =>1, Elements => (1 => 1));
procedure Iter is
begin
for I in 1 .. Loop_Optimization8_Pkg2.Length (Data) loop
Action (Loop_Optimization8_Pkg2.Index (Data, I));
end loop;
end;
end Loop_Optimization8_Pkg1;

View File

@ -0,0 +1,20 @@
with Ada.Finalization;
package Loop_Optimization8_Pkg1 is
type Array_T is array (Positive range <>) of Natural;
type Array_Access_T is access Array_T;
type T is new Ada.Finalization.Controlled with record
Last : Natural := 0;
Elements : Array_Access_T;
end record;
Empty : T := (Ada.Finalization.Controlled with Last => 0, Elements => null);
generic
with procedure Action (Info : Natural);
procedure Iter;
end Loop_Optimization8_Pkg1;

View File

@ -0,0 +1,13 @@
package body Loop_Optimization8_Pkg2 is
function Length (Set : T) return Natural is
begin
return Set.Length;
end Length;
function Index (Set : T; Position : Natural) return Integer is
begin
return Set.Elements (Position);
end Index;
end Loop_Optimization8_Pkg2;

View File

@ -0,0 +1,16 @@
package Loop_Optimization8_Pkg2 is
type Array_T is array (Natural range <>) of Integer;
type Obj_T (Length : Natural) is
record
Elements : Array_T (1 .. Length);
end record;
type T is access Obj_T;
function Length (Set : T) return Natural;
function Index (Set : T; Position : Natural) return Integer;
pragma Inline (Length, Index);
end Loop_Optimization8_Pkg2;