This is the mail archive of the gcc-bugs@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]

Re: gcc 2.95.2 PPC code generation bug(New version!)



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.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

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