gcc 2.95.2 PPC code generation bug(New version!)
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Tue May 2 01:48:00 GMT 2000
At 00:02 02.05.00, Geoff Keating wrote:
>root <root@enzo.bigblue.local> writes:
>
> > int result = ({
> > struct test mytest;
> > ({
> > int testi;
> > testi = func (&mytest);
> > testi;
> > })
> > });
>
> > You expect TESTI to be assigned to RESULT, but I think this is not
> > covered by the definition of statement expressions in the GCC manual
> > (at least not to my understanding). I believe you have to rewrite
> > your macros to produce code like that:
>
>I believe this should work. The manual says
>
> The last thing in the compound statement should be an expression
> followed by a semicolon; the value of this subexpression serves as the
> value of the entire construct.
>
>Of course, there is a missing semicolon in the above; it should read
>
>int result = ({
> struct test mytest;
> ({
> int testi;
> testi = func (&mytest);
> testi;
> });
>});
>
>but that should work. In fact, it does for me.
Yes, that looks OK, but in fact I did quote Ralph incorrectly, he wrote:
int result = ({
struct test mytest;
{
int testi;
testi = func (&mytest);
testi;
}
});
which compiles, but is no valid statement expression...
Franz.
More information about the Gcc-bugs
mailing list