[patch] Fix ICE on function [not] returning variable size
Eric Botcazou
ebotcazou@adacore.com
Mon Jun 1 10:45:00 GMT 2015
Hi,
this fixes an ICE on a function returning a variable-sized record type but
discovered to be no-return by the optimizer. In this case, the LHS of the
GIMPLE call statement is removed so the RTL expander attempts to allocate a
temporary and fails:
eric@polaris:~/build/gcc/native> gcc/gnat1 -quiet varsize_return2.ads -O
+===========================GNAT BUG DETECTED==============================+
| 6.0.0 20150531 (experimental) [trunk revision 223897] (x86_64-suse-linux)
GCC error:|
| in assign_stack_temp_for_type, at function.c:793
because it too cannot create temporaries of variable size.
The attached patch simply preserves the LHS throughout the GIMPLE pipeline.
It also simplifies the relevant test in gimplify_modify_expr_rhs, which was
overly broad.
Tested on x86_64-suse-linux, OK for the mainline?
2015-06-01 Eric Botcazou <ebotcazou@adacore.com>
* gimplify.c (gimplify_modify_expr_rhs): Use simple test on the size.
* cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Do not remove
the LHS of a no-return call if its type has variable size.
* tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
* tree-cfg.c (verify_gimple_call): Accept these no-return calls.
2015-06-01 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/varsize_return2.ads: New test.
* gnat.dg/specs/varsize_return2_pkg.ad[sb]: New helper.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 3916 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150601/a201250e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: varsize_return2.ads
Type: text/x-adasrc
Size: 213 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150601/a201250e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: varsize_return2_pkg.adb
Type: text/x-adasrc
Size: 293 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150601/a201250e/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: varsize_return2_pkg.ads
Type: text/x-adasrc
Size: 341 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150601/a201250e/attachment-0003.bin>
More information about the Gcc-patches
mailing list