statement expressions and extended asm bug?

Nathan Sidwell nathan@codesourcery.com
Tue Mar 16 17:54:00 GMT 2004


Gunther Nikl wrote:
> On Mon, Mar 15, 2004 at 05:50:36PM +0000, Nathan Sidwell wrote:

>>(in g++, statement expressions always produce a result 'as-if' by
>>'return').
> 
> 
>   Does that mean with g++ it should work? I just tried with 3.3 and it
>   doesn't.
It seems that those changes didn't make it to 3.3, but will be in 3.4.
See PR 11295 for details

>>Perhaps your rewriting of the asm is effectively making the same change.
>   AFAICT from the discussion so far, even if it works with the nested
>   s-e's, its still wrong.
I think the nested s-e's are ok.


>>Your example is IMHO another case of why statement-exprs should return
>>rvalues!
>   And then I could use s-e as a function argument as I did?
only the nested ones,

> On Tue, Mar 16, 2004 at 09:12:15AM +0000, Nathan Sidwell wrote:
> 
>>Having statement expressions silently extend the lifetime of an lvalue
>>declared within is a great way to trip users up.
>   Is that "my" problem?
er, sort of. IMHO it is a bug in the mechanism by which s-e's return
values, and you have fallen over it by your use of the register asm
variable.

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