[patch] Fix ICE with -flto on function returning variable-sized type

Eric Botcazou ebotcazou@adacore.com
Wed May 5 13:50:00 GMT 2010


Hi,

in Ada functions can return a type with a non-fixed size, typically whose size 
depends on some global variable.  This works because gigi makes it so that 
calls to such functions use the Return Slot Optimization, so there is no need 
to allocate a temporary anywhere during gimplification.

But this breaks with -flto because nobody has gimplified the size expressions 
of the RESULT_DECL, so they can contain CALL_EXPRs and the streamer chokes.

Fixed by gimplifying the expressions in gimplify_return_expr.  Tested on 
i586-suse-linux, OK for mainline?


2010-05-05  Eric Botcazou  <ebotcazou@adacore.com>

	* gimplify.c (gimplify_return_expr): Gimplify the size expressions of
	a variable-sized RESULT_DECL.


2010-05-05  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/lto2.adb: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 1347 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100505/2dcc70a5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lto2.adb
Type: text/x-adasrc
Size: 574 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100505/2dcc70a5/attachment-0001.bin>


More information about the Gcc-patches mailing list