[Ada] Fix internal error on array slice in loop and Loop_Invariant
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 22 Jul 2019 13:56:26 +0000 (13:56 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 22 Jul 2019 13:56:26 +0000 (13:56 +0000)
commitc961d8205b749d6df462202efd09efa6bf01442d
tree054d1c52fc795b26a8ba5c7f5fe0514114e8cd40
parent8801ca5c28c3a9e9f36fa39a6a4455b48c8221fa
[Ada] Fix internal error on array slice in loop and Loop_Invariant

This fixes an internal error caused by the presence of an Itype in a
wrong scope.  This Itype is created for an array slice present in the
condition of a while loop whose body also contains a pragma
Loop_Invariant, initially in the correct scope but then relocated into a
function created for the pragma.

2019-07-22  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_attr.adb (Expand_Loop_Entry_Attribute): Copy the condition
of a while loop instead of simply relocating it.

gcc/testsuite/

* gnat.dg/loop_invariant1.adb, gnat.dg/loop_invariant1.ads: New
testcase.

From-SVN: r273668
gcc/ada/ChangeLog
gcc/ada/exp_attr.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/loop_invariant1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/loop_invariant1.ads [new file with mode: 0644]