aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-11-25 10:48:55 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-11-25 10:48:55 +0000
commitd587d1e4aa6a33372f64b0f3983ef66afa3d1897 (patch)
tree5be921b4dc8697403ff531e31f135ddf88ee3922 /gcc/testsuite/gnat.dg
parent32bef8ff8090a0d108fa14fc4088e55e57a5e6d5 (diff)
downloadgcc-d587d1e4aa6a33372f64b0f3983ef66afa3d1897.zip
gcc-d587d1e4aa6a33372f64b0f3983ef66afa3d1897.tar.gz
gcc-d587d1e4aa6a33372f64b0f3983ef66afa3d1897.tar.bz2
re PR ada/92362 (double elaboration of expression in Address aspect)
PR ada/92362 * gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>: Use a temporary instead of clobbering the result with a freeze node. From-SVN: r278675
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r--gcc/testsuite/gnat.dg/addr14.adb24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/addr14.adb b/gcc/testsuite/gnat.dg/addr14.adb
new file mode 100644
index 0000000..e92c902
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/addr14.adb
@@ -0,0 +1,24 @@
+-- { dg-do run }
+
+with System;
+
+procedure Addr14 is
+
+ type Arr is array (1 .. 4) of aliased Integer;
+
+ A : Arr := (1, 2, 3, 4);
+ I : Natural := 0;
+
+ function Get_Address return System.Address is
+ begin
+ I := I + 1;
+ return A(I)'Address;
+ end;
+
+ Foo : Integer with Address => Get_Address;
+
+begin
+ if Foo /= 1 then
+ raise Program_Error;
+ end if;
+end;