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

2009-10-27 Thread Jakub Jelinek
On Mon, Oct 26, 2009 at 09:40:06AM -0700, Andrew Pinski wrote: > Except (b) is correct as fold should not be modifiying the tree at > all. That is the whole point of fold_checksum_tree. We allow some > things to change like TYPE_VARIANTs and such but we should not allow a The TYPE_VARIANTs case

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

2009-10-26 Thread Richard Guenther
On Mon, Oct 26, 2009 at 10:42 PM, Aldy Hernandez wrote: >> Certainly better.  But I fail to see why a different location would be >> better than the original here.  I assume all tokens have a correct initial >> location.  Then why is for example for int i;  in (int) i the location of >> the conver

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

2009-10-26 Thread Aldy Hernandez
> Certainly better. But I fail to see why a different location would be > better than the original here. I assume all tokens have a correct initial > location. Then why is for example for int i; in (int) i the location of > the conversion a better location than the one of i in the folded result

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

2009-10-26 Thread Richard Guenther
On Mon, Oct 26, 2009 at 6:28 PM, Aldy Hernandez wrote: >> That wasn't my question. >> >>      tem = fold_build2_loc (loc, code, type, >>                             fold_convert_loc (loc, TREE_TYPE (op0), >>                                               TREE_OPERAND (arg0, 1)), op1); >>      prote

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

2009-10-26 Thread Aldy Hernandez
> 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

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

2009-10-26 Thread Richard Guenther
On Mon, Oct 26, 2009 at 5:37 PM, Aldy Hernandez wrote: >> > ? ? ?tem = fold_build2_loc (loc, code, type, >> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? fold_convert_loc (loc, TREE_TYPE (op0), >> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TREE_OPERAND (arg0, 1)), >> > op1); >> > ? ? ?protected_set_expr_loc

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

2009-10-26 Thread Andrew Pinski
On Mon, Oct 26, 2009 at 9:37 AM, Aldy Hernandez wrote: > We have two options: > > a) Allow locus changes in fold_checksum_tree. > b) Fix fold-const throughout to make a copy of the result of fold_build* > calls if we're about to change it's location-- in case fold is returning > any of the origina

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

2009-10-26 Thread Aldy Hernandez
> > ? ? ?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 verifi

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

2009-10-26 Thread Richard Guenther
On Mon, Oct 26, 2009 at 4:39 PM, Aldy Hernandez 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

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

2009-10-26 Thread Aldy Hernandez
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 (lo