aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2019-08-20 09:50:00 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-20 09:50:00 +0000
commitb6b011dd38da56a04dbf7d27833d015f2789a6f5 (patch)
tree9c05a43e1234080f351d8318fad0884467a8d662 /gcc/testsuite/gnat.dg
parent1233757a2dd3bf314aa308e51cbaeb6a512d59db (diff)
downloadgcc-b6b011dd38da56a04dbf7d27833d015f2789a6f5.zip
gcc-b6b011dd38da56a04dbf7d27833d015f2789a6f5.tar.gz
gcc-b6b011dd38da56a04dbf7d27833d015f2789a6f5.tar.bz2
[Ada] Crash on Loop_Entry for while_loop involving substrings
When expanding a loop entry attribute for a while_loop we construct a function that incorporates the expanded condition of the loop. The itypes that may be generated in that expansion must carry the scope of the constructed function for proper handling in the backend. 2019-08-20 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_attr.adb (Expand_Loop_Entry_Attribute): When expanding a loop entry attribute for a while_loop we construct a function that incorporates the expanded condition of the loop. The itypes that may be generated in that expansion must carry the scope of the constructed function for proper handling in gigi. gcc/testsuite/ * gnat.dg/loop_entry2.adb: New testcase. From-SVN: r274734
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r--gcc/testsuite/gnat.dg/loop_entry2.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/loop_entry2.adb b/gcc/testsuite/gnat.dg/loop_entry2.adb
new file mode 100644
index 0000000..1708e73
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/loop_entry2.adb
@@ -0,0 +1,11 @@
+-- { dg-do compile }
+-- { dg-options "-gnata" }
+
+procedure Loop_Entry2 (S : String) is
+ J : Integer := S'First;
+begin
+ while S(J..J+1) = S(J..J+1) loop
+ pragma Loop_Invariant (for all K in J'Loop_Entry .. J => K <= J);
+ J := J + 1;
+ end loop;
+end;