[PATCH] Fix SRA problem with variable-sized field

Richard Guenther richard.guenther@gmail.com
Sun Sep 16 20:12:00 GMT 2007


On 9/16/07, Eric Botcazou <ebotcazou@adacore.com> wrote:
> 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?

Ok.

Thanks,
Richard.

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



More information about the Gcc-patches mailing list