invalid expression evaluation in gcc

Nathan Sidwell nathan@codesourcery.com
Mon Dec 3 02:07:00 GMT 2001


Griff Smith wrote:
> Description:    The values of the two occurrences of (tmpvar->num = tmpnum)
>                 are not computed correctly; I think the compiler loses track

It looks to me like your code is the moral equivalent of
	int tmp;
	if ((tmp = expr1, tmp) > (tmp = expr2, tmp))

which is undefined. There is more than one write to tmp without an
intervening sequence point.  The LHS of the two ',' operators are
not ordered wrt each other.

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org



More information about the Gcc-bugs mailing list