trans.c (Raise_Error_to_gnu): Record the unpadded type of the index type on the RCI...
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 6 Mar 2013 17:49:33 +0000 (17:49 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 6 Mar 2013 17:49:33 +0000 (17:49 +0000)
* gcc-interface/trans.c (Raise_Error_to_gnu) <CE_Index_Check_Failed>:
Record the unpadded type of the index type on the RCI stack.

From-SVN: r196504

gcc/ada/ChangeLog
gcc/ada/gcc-interface/trans.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/loop_optimization15.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/loop_optimization15.ads [new file with mode: 0644]

index fc34359..9c6df96 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-03  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/trans.c (Raise_Error_to_gnu) <CE_Index_Check_Failed>:
+       Record the unpadded type of the index type on the RCI stack.
+
 2013-03-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/trans.c (emit_range_check): Assert that the range type
index 69904bc..8cdc632 100644 (file)
@@ -4944,7 +4944,7 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
            {
              rci->low_bound = gnu_low_bound;
              rci->high_bound = gnu_high_bound;
-             rci->type = gnat_to_gnu_type (gnat_type);
+             rci->type = get_unpadded_type (gnat_type);
              rci->invariant_cond = build1 (SAVE_EXPR, boolean_type_node,
                                            boolean_true_node);
              gnu_cond = build_binary_op (TRUTH_ANDIF_EXPR,
index df583d6..393e5a4 100644 (file)
@@ -1,3 +1,7 @@
+2013-06-03  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/loop_optimization15.ad[sb]: New test.
+
 2013-03-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/56548
diff --git a/gcc/testsuite/gnat.dg/loop_optimization15.adb b/gcc/testsuite/gnat.dg/loop_optimization15.adb
new file mode 100644 (file)
index 0000000..ff53575
--- /dev/null
@@ -0,0 +1,20 @@
+-- { dg-do compile }\r
+-- { dg-options "-O3" }\r
+\r
+package body Loop_Optimization15 is\r
+\r
+  type Integer_Array_T is array (B16_T range <>) of Integer;\r
+\r
+  Len : constant B16_T := 10;\r
+\r
+  Src : constant Integer_Array_T (1 .. Len) := (others => 0);\r
+  Dst : Integer_Array_T (1 .. Len);\r
+\r
+  procedure Proc (L : B16_T) is\r
+  begin\r
+      for I in  1 .. B16_T'Min (L, Len) loop\r
+          Dst (I) := Src (I);\r
+      end loop;\r
+  end;\r
+\r
+end Loop_Optimization15;\r
diff --git a/gcc/testsuite/gnat.dg/loop_optimization15.ads b/gcc/testsuite/gnat.dg/loop_optimization15.ads
new file mode 100644 (file)
index 0000000..d7d04e4
--- /dev/null
@@ -0,0 +1,9 @@
+package Loop_Optimization15 is\r
+\r
+  type B16_T is mod 2 ** 16;\r
+  for B16_T'Size use 16;\r
+  for B16_T'Alignment use 1;\r
+\r
+  procedure Proc (L : B16_T);\r
+\r
+end Loop_Optimization15;\r