From 6f71e355ebcc5e6e3474369ea5dd361d3ee5875d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 6 Mar 2013 17:49:33 +0000 Subject: [PATCH] trans.c (Raise_Error_to_gnu): Record the unpadded type of the index type on the RCI stack. * gcc-interface/trans.c (Raise_Error_to_gnu) : Record the unpadded type of the index type on the RCI stack. From-SVN: r196504 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/loop_optimization15.adb | 20 +++++++++++++++++++ gcc/testsuite/gnat.dg/loop_optimization15.ads | 9 +++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gnat.dg/loop_optimization15.adb create mode 100644 gcc/testsuite/gnat.dg/loop_optimization15.ads diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fc3435986be..9c6df965b6e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2013-06-03 Eric Botcazou + + * gcc-interface/trans.c (Raise_Error_to_gnu) : + Record the unpadded type of the index type on the RCI stack. + 2013-03-06 Eric Botcazou * gcc-interface/trans.c (emit_range_check): Assert that the range type diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 69904bc47de..8cdc632cca5 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -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, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df583d6a03b..393e5a4190b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-06-03 Eric Botcazou + + * gnat.dg/loop_optimization15.ad[sb]: New test. + 2013-03-06 Jakub Jelinek 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 index 00000000000..ff53575ef9b --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization15.adb @@ -0,0 +1,20 @@ +-- { dg-do compile } +-- { dg-options "-O3" } + +package body Loop_Optimization15 is + + type Integer_Array_T is array (B16_T range <>) of Integer; + + Len : constant B16_T := 10; + + Src : constant Integer_Array_T (1 .. Len) := (others => 0); + Dst : Integer_Array_T (1 .. Len); + + procedure Proc (L : B16_T) is + begin + for I in 1 .. B16_T'Min (L, Len) loop + Dst (I) := Src (I); + end loop; + end; + +end Loop_Optimization15; diff --git a/gcc/testsuite/gnat.dg/loop_optimization15.ads b/gcc/testsuite/gnat.dg/loop_optimization15.ads new file mode 100644 index 00000000000..d7d04e4d353 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization15.ads @@ -0,0 +1,9 @@ +package Loop_Optimization15 is + + type B16_T is mod 2 ** 16; + for B16_T'Size use 16; + for B16_T'Alignment use 1; + + procedure Proc (L : B16_T); + +end Loop_Optimization15; -- 2.30.2