statement expressions and extended asm bug?
Nathan Sidwell
nathan@codesourcery.com
Tue Mar 16 09:12:00 GMT 2004
Jamie Lokier wrote:
> More to the point, calling the foo(arg) above from different function
> arguments isn't a sequence-point violation, unlike calling the
> statement-expressions.
>
> function(foo(arg1), foo(arg2));
>
> could evaluate the two calls to foo() in either order, but it must
> finish one completely before the other.
I thought that was true in C++ but not C. Perhaps C99 tightened it
up, or my memory is bad, or C89 never actually specified, given
that it didn't have 'inline', so overlapping was not feasible.
Gunther's code became invalid becuase the two statement expressions
both returned different lvalues, but forced into the same register (via
yet another GNU extension).
It is probably an 'accident of design' that tree inlining into statement
exprs DTRT, because functions do not return lvalues at that level, and
the expander is sequential in its RTL emission.
Having statement expressions silently extend the lifetime of an lvalue
declared within is a great way to trip users up.
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