[PATCH] Fix SRA problem with variable-sized field
Eric Botcazou
ebotcazou@adacore.com
Sun Sep 16 14:36:00 GMT 2007
Hi,
This is a case where a record with a variable-sized field slips through the
cracks of the guards put in place in SRA against them, leading to an ICE
because iterative_hash_expr is not supposed to see PLACEHOLDER_EXPRs.
SRA is trying to decide whether to scalarize a record m (unfortunately I have
no testcase for the mainline compiler).
First, although m contains a record with variable size F, it is of fixed size
because of the padding; so the check in sra_type_can_be_decomposed_p doesn't
catch it because the predicate is not recursive (by design).
Second, although sra_walk_expr has a check against fields at variable offsets,
it doesn't catch F because it is at offset 0 despite being of variable size.
When maybe_lookup_element_for_expr is invoked, it will try to compute a hash
value for the field F and runs into the PLACEHOLDER_EXPR.
Fixed by dealing with variable-sized records exactly like with unions in SRA,
i.e. by explicitly balking at them.
Tested on i586-suse-linux, OK for mainline?
2007-09-16 Eric Botcazou <ebotcazou@adacore.com>
* tree-sra.c (maybe_lookup_element_for_expr) <COMPONENT_REF>: Return
NULL for variable-sized records too.
(sra_walk_expr) <COMPONENT_REF>: Stop at variable-sized records too.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 1622 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070916/f383d7c6/attachment.bin>
More information about the Gcc-patches
mailing list