aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt45.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-11-24 08:18:40 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-11-24 08:18:40 +0000
commit90b4c164f4c725bfd77c1a1c6ad574604b423401 (patch)
treed3dce21e6f62462c4a3162939a961e2744aecfb6 /gcc/testsuite/gnat.dg/opt45.adb
parent29e0597e2530cc21fe964e35c6cfbfadfb08a01e (diff)
downloadgcc-90b4c164f4c725bfd77c1a1c6ad574604b423401.zip
gcc-90b4c164f4c725bfd77c1a1c6ad574604b423401.tar.gz
gcc-90b4c164f4c725bfd77c1a1c6ad574604b423401.tar.bz2
trans.c (push_range_check_info): Replace early test with assertion.
* gcc-interface/trans.c (push_range_check_info): Replace early test with assertion. (Raise_Error_to_gnu): Do not call push_range_check_info if the loop stack is empty. * gcc-interface/utils.c (convert_to_fat_pointer): Fix formatting. * gcc-interface/utils2.c (gnat_invariant_expr): Deal with padded types and revert latest change. From-SVN: r217998
Diffstat (limited to 'gcc/testsuite/gnat.dg/opt45.adb')
-rw-r--r--gcc/testsuite/gnat.dg/opt45.adb38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/opt45.adb b/gcc/testsuite/gnat.dg/opt45.adb
new file mode 100644
index 0000000..f75e46e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt45.adb
@@ -0,0 +1,38 @@
+-- { dg-do compile }
+-- { dg-options "-O3" }
+
+procedure Opt45 is
+
+ type Index_T is mod 2 ** 32;
+ for Index_T'Size use 32;
+ for Index_T'Alignment use 1;
+
+ type Array_T is array (Index_T range <>) of Natural;
+ type Array_Ptr_T is access all Array_T;
+
+ My_Array_1 : aliased Array_T := (1, 2);
+ My_Array_2 : aliased Array_T := (3, 4);
+
+ Array_Ptr : Array_Ptr_T := null;
+ Index : Index_T := Index_T'First;
+
+ My_Value : Natural := Natural'First;
+
+ procedure Proc (Selection : Positive) is
+ begin
+ if Selection = 1 then
+ Array_Ptr := My_Array_1'Access;
+ Index := My_Array_1'First;
+ else
+ Array_Ptr := My_Array_2'Access;
+ Index := My_Array_2'First;
+ end if;
+
+ if My_Value = Natural'First then
+ My_Value := Array_Ptr.all (Index);
+ end if;
+ end;
+
+begin
+ Proc (2);
+end;