[ast-optimizer-branch] simplification fixes for stage1 [patch]

Daniel Berlin dberlin@dberlin.org
Thu May 2 14:25:00 GMT 2002


On Thu, 2 May 2002, Diego Novillo wrote:

> On Thu, 02 May 2002, Daniel Berlin wrote:
> 
> > > Hah.
> > > 
> > > With these changes, the statement expression simplification works fine.
> > Wait, no, it doesn't.
> > 
> Bummer.  Well, there are still several serious bugs because we
> can't even bootstrap.  I plan to keep fixing things until we can
> bootstrap and pass the testsuite with no regressions.
> 
> Hopefully you will have found the fix by then.  If not, we can
> figure something out.
I'm getting closer.

It actually appears what happens is that we make a copy of the decl (the 
one it generates rtl for is *not* built through build_decl), and that ends 
being the one in the DECL_STMT.
However, the one in the use is the non-copy.
So the RTL gets set on the copy when it hits the DECL_STMT, but because 
it's not the one the use refers to, we abort.


Ding ding ding.

in c-simplify.c, we do:
  case DECL_STMT:
2430          res = build_stmt (DECL_STMT,
2431                            (DECL_STMT_DECL (node) ?
2432                             copy_node (DECL_STMT_DECL (node)) : 
NULL_TREE));
2433          break;

as part of deep copies (which we do when simplifying the for loop 
initializer, which is where this appears).

But by doing this, we aren't going to have things using the right 
VAR_DECL anymore, because they'll refer to the original, not the copy!


Yup.
That does it.

At least, we get past where we were before.

I suspect this will cause stage2 errors for you as well. It's going to 
generate code that references the wrong variables, or uses of 
uninitialized variables, whenever we deep copy.

it should be

DECL_STMT,
(DECL_STMT_DECL (node) ? DECL_STMT_DECL (node) : NULL_TREE)


 > 
> 
> Diego.
> 



More information about the Gcc-patches mailing list