[Ada] Fix crash on function with In-Out param returning discriminated type

Eric Botcazou ebotcazou@adacore.com
Wed Nov 5 19:17:00 GMT 2014


The compiler crashes on a function with an In-Out parameter which returns a 
discriminated record type with default discriminant.

Tested on x86_64-suse-linux, applied on the mainline.


2014-11-05  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): For a function with
	copy-in/copy-out parameters and which returns by invisible reference,
	do not create the variable for the return value; instead, manually
	generate the indirect copy out statements on exit.
	(gnat_to_gnu) <N_Simple_Return_Statement>: Adjust accordingly and build
	a simple indirect assignment for the return value.


2014-11-05  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/discr42.adb: New test.
	* gnat.dg/discr42_pkg.ad[sb]: New helper.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discr42.adb
Type: text/x-adasrc
Size: 264 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141105/b8a2f528/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: discr42_pkg.adb
Type: text/x-adasrc
Size: 254 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141105/b8a2f528/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 6442 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141105/b8a2f528/attachment-0002.bin>


More information about the Gcc-patches mailing list