[PATCH] Crash during expression optimization

Peter Johnson peter at tortall.net
Tue Sep 30 10:33:39 PDT 2008


On Tue, 30 Sep 2008 11:47:51 +0200, Samuel Thibault wrote
> Peter Johnson, le Mon 29 Sep 2008 21:01:14 -0700, a écrit :
> > I was able to trace the bug down to a smaller fix,
> 
> Ah, right, I actually realised e->numterms in the for statement was
> wrong _after_ fixing the case when o < i.  I'm still wondering what
> prevents the latter from happening though: is e.g. 1 + (1 + 1) supposed
> to never happen thanks to earlier optimizations?  In such a case we
> would end up with level_numterms going down to 1 while fold_numterms 
> is still 2.

Yes, that case will never happen.  expr_level_op() is called bottom-up on the
expression tree by expr_level_tree(), so:
1 + (1 + 1)
..level_op called on (1+1) expression..
1 + 2
..level_op called on 1+2 expression..
3

Peter



More information about the yasm-devel mailing list