On Mon, Oct 26, 2009 at 5:37 PM, Aldy Hernandez <al...@redhat.com> wrote: >> > ? ? ?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. > > The correct location is being passed. The problem is that in the > testcase in question, we modify the original statement (with the new > locus). Modifying the original statement is a no no in > fold_checksum_tree.
That wasn't my question. 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); here tem is built by calling fold_build2_loc. So why is the location of tem not loc after that. This sounds like the actual bug (and the protected_set_expr_location should be redundant). Richard.