[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#278081: gcc-3.3: REGRESSION: Doesn't follow precedence



On Sun, Oct 24, 2004 at 02:31:54PM -0500, Adam Majer wrote:
> Anyway, I do remember that the precedence occurs as in order (for above
> example)
> 
> unary -
> + -
> 
> I would expect X() and Y() to be undetermined until actually evaluated.
> That is,
> 
> -X()+Y()
> -x+Y(), where x=evaluated X()
> x'+Y(), where x' = -x
> x'+y, where y=evaluated Y()
> 
> According to upstream (and ISO C), -X()+Y() can be evaluated as,
> 
> -X()+Y()
> -X()+y
> -x+y
> x'+y
> 
> This essentially means that precedence is not followed if Y depends on X
> or vice-versa.
> 
> Blah.... Now I have to go and rewrite some code...

This isn't a question of precedence, which only affects the way an
expression is interpreted.  It's strictly a problem of evaluation
order.  Precedence determines how the expression is parsed, i.e.
(-X()) + Y() vs (-X() + Y) () an so forth.

-- 
Daniel Jacobowitz



Reply to: