aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-10-25 17:26:04 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-10-25 17:26:04 +0000
commit8c211c83bba629be6318b5b3fba7137cf633ef9a (patch)
tree579321e1bafe5b6bd421b4622738b3e8515093cd /gcc
parent570f4691719a51481deae0109e358a605dd35604 (diff)
downloadgcc-8c211c83bba629be6318b5b3fba7137cf633ef9a.zip
gcc-8c211c83bba629be6318b5b3fba7137cf633ef9a.tar.gz
gcc-8c211c83bba629be6318b5b3fba7137cf633ef9a.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/decl.c1
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization8.adb30
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization8_pkg1.adb15
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization8_pkg1.ads20
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization8_pkg2.adb13
-rw-r--r--gcc/testsuite/gnat.dg/loop_optimization8_pkg2.ads16
8 files changed, 105 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index cf21c37..4ae15c6 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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):
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 8a284ea..b7fe778 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index eb4ce23..9255d05 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
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.
* gnat.dg/in_out_parameter3.adb: Likewise.
diff --git a/gcc/testsuite/gnat.dg/loop_optimization8.adb b/gcc/testsuite/gnat.dg/loop_optimization8.adb
new file mode 100644
index 0000000..6be28f1
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization8.adb
@@ -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;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization8_pkg1.adb b/gcc/testsuite/gnat.dg/loop_optimization8_pkg1.adb
new file mode 100644
index 0000000..3c3368d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization8_pkg1.adb
@@ -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;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization8_pkg1.ads b/gcc/testsuite/gnat.dg/loop_optimization8_pkg1.ads
new file mode 100644
index 0000000..e6f3c70
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization8_pkg1.ads
@@ -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;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization8_pkg2.adb b/gcc/testsuite/gnat.dg/loop_optimization8_pkg2.adb
new file mode 100644
index 0000000..9b9a3de
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization8_pkg2.adb
@@ -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;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization8_pkg2.ads b/gcc/testsuite/gnat.dg/loop_optimization8_pkg2.ads
new file mode 100644
index 0000000..b92cb58
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_optimization8_pkg2.ads
@@ -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;