This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: statement expressions and extended asm bug?


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]