Fix internal error on problematic renaming
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 May 2020 08:42:28 +0000 (10:42 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 May 2020 08:44:00 +0000 (10:44 +0200)
commitaf62ba41a4ed1e760e0056ba142798e8d6266e4d
tree2f78fc1355fd67fd0cf40630b31b57d2b8726d24
parent0949185aed5830fe40bd4fa4a80b21bc90410406
Fix internal error on problematic renaming

This is an internal renaming generated for a generalized loop iteration
made on a tagged record type with predicate, and gigi cannot use the most
efficient way of implementing renamings because the renamed object is an
expression with a non-empty Actions list.

gcc/ada/ChangeLog
* gcc-interface/decl.c (gnat_to_gnu_entity): Add new local variable
and use it throughout the function.
<E_Variable>: Rename local variable and adjust accordingly.  In the
case of a renaming, materialize the entity if the renamed object is
an N_Expression_With_Actions node.
<E_Procedure>: Use Alias accessor function consistently.

gcc/testsuite/ChangeLog
* gnat.dg/renaming16.adb: New test.
* gnat.dg/renaming16_pkg.ads: New helper.
gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/renaming16.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/renaming16_pkg.ads [new file with mode: 0644]