Fix wrong assignment to mutable Out parameter of task entry
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 May 2020 07:18:03 +0000 (09:18 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 May 2020 07:25:57 +0000 (09:25 +0200)
commit5dce843f32edfd998ae4844d8115a9c9b9c394bc
treea8057058326d856b8ee25828bb2fa8e40e7192f6
parent94c0409717bf8bf783963c1d50bb8f4a4732dce7
Fix wrong assignment to mutable Out parameter of task entry

Under very specific circumstances the compiler can generate a wrong
assignment to a mutable record object which contains an array component,
because it does not correctly handle the update of the discriminant.

gcc/ada/ChangeLog
* gcc-interface/gigi.h (operand_type): New static inline function.
* gcc-interface/trans.c (gnat_to_gnu): Do not suppress conversion
to the resulty type at the end for array types.
* gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Do not
remove conversions between array types on the LHS.

gcc/testsuite/ChangeLog
* gnat.dg/array39.adb: New test.
* gnat.dg/array39_pkg.ads: New helper.
* gnat.dg/array39_pkg.adb: Likewise.
gcc/ada/gcc-interface/gigi.h
gcc/ada/gcc-interface/trans.c
gcc/ada/gcc-interface/utils2.c
gcc/testsuite/gnat.dg/array39.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array39_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array39_pkg.ads [new file with mode: 0644]