[Ada] Fix wrong assignment to mutable Out parameter of task entry

Eric Botcazou botcazou@adacore.com
Mon May 25 07:27:18 GMT 2020


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.

Tested on x86-64/Linux, applied on the mainline.


2020-05-25  Eric Botcazou  <ebotcazou@adacore.com>

	* 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.


2020-05-25  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/array39.adb: New test.
	* gnat.dg/array39_pkg.ads: New helper.
	* gnat.dg/array39_pkg.adb: Likewise.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 5847 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200525/ad455b99/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array39.adb
Type: text/x-adasrc
Size: 183 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200525/ad455b99/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array39_pkg.ads
Type: text/x-adasrc
Size: 502 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200525/ad455b99/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array39_pkg.adb
Type: text/x-adasrc
Size: 375 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200525/ad455b99/attachment-0007.bin>


More information about the Gcc-patches mailing list