statement expressions and extended asm bug?

Nathan Sidwell nathan@codesourcery.com
Fri Mar 19 16:20:00 GMT 2004


Segher Boessenkool wrote:
> 
> On 19-mrt-04, at 14:53, Jamie Lokier wrote:
> 
>> Hans-Peter Nilsson wrote:

>> That's undefined.  This isn't undefined:
>>
>>     static inline void increment (int * ptr) { *ptr++; return 0; }
>>     func (increment (&a), increment (&a));

> No, it is just as undefined.  The compiler is free to call
> either the "left" or the "right" increment() first.

Why is this undefined? Isn't it just unspecified? If I understand
the DR Joseph pointed me too, the order of the two function calls
is unspecified, but they do not overlap and there is a sequence point
just before each call (after the arguments have been evaluated), and
a sequence point before each returns.

The original stmt-expr problem is more akin to the following (if stmt-exprs
were to produce rvalues in a return-like way),
   int var;
   static inline int frob (int x) {var = x; return var;}
   func (frob (12), frob (13));
Are you saying this is undefined too?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk




More information about the Gcc mailing list