[Ada] Spurious error on case expression with limited result
authorHristian Kirtchev <kirtchev@adacore.com>
Wed, 10 Jul 2019 09:01:38 +0000 (09:01 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 10 Jul 2019 09:01:38 +0000 (09:01 +0000)
commit5b4ce2a0360a79751107c245c2e44c0932835164
treea336c598eb7e8be8d55e2478f01b8aeea26a05f4
parent7f8c1cd3675b0e30817d98e52740b918b4e970b0
[Ada] Spurious error on case expression with limited result

This patch modifies the expansion of case expressions to prevent a
spurious error caused by the use of assignment statements to capture the
result of the case expression when the associated type is limited.

2019-07-10  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* exp_ch4.adb (Expand_N_Case_Expression): Mark the generated
assignments to the temporary result as being OK because the
expansion of case expressions is correct by construction.
(Is_Copy_Type): Update the predicate to match the comment
within.

gcc/testsuite/

* gnat.dg/limited2.adb, gnat.dg/limited2_pack_1.adb,
gnat.dg/limited2_pack_1.ads, gnat.dg/limited2_pack_2.adb,
gnat.dg/limited2_pack_2.ads: New testcase.

From-SVN: r273336
gcc/ada/ChangeLog
gcc/ada/exp_ch4.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/limited2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited2_pack_1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited2_pack_1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited2_pack_2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/limited2_pack_2.ads [new file with mode: 0644]