RFC: allowing fold to change location of args (PR/41451)

Richard Guenther richard.guenther@gmail.com
Mon Oct 26 16:40:00 GMT 2009


On Mon, Oct 26, 2009 at 4:39 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
> Hi folks.
>
> In this PR the problem is that a call to fold_build2_loc() returns one
> of the original arguments unchanged.  In the code below we take this
> result and change its location before returning it.
>
>      tem = fold_build2_loc (loc, code, type,
>                             fold_convert_loc (loc, TREE_TYPE (op0),
>                                               TREE_OPERAND (arg0, 1)), op1);
>      protected_set_expr_location (tem, loc);
>
> When --enable-checking=fold, fold verifies that none of the arguments
> changed, which in this case it obviously does.
>
> Would be ok to allow a TREE_EXP's location to change within fold?  That is,
> add locus (for TREE_EXP's) to the list of allowed changeable fields in
> fold_checksum_tree()?

Why?  It looks like the above should already take care of the
correct location via passing loc to fold_build2_loc.

Richard.



More information about the Gcc mailing list