This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 2.95.2 PPC code generation bug
- To: laire at popmail dot owl dot de
- Subject: Re: gcc 2.95.2 PPC code generation bug
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: 14 Aug 2000 01:05:46 -0700
- CC: gcc-bugs at gcc dot gnu dot org
- References: <200004251543.AA00324@basis.owl.de>
Ralph Schmidt <laire@basis.owl.de> writes:
> In a rekursive dynamicly initialized array gcc forgets to set the result of
> a function call. Please look into the .c file to see a closer description
> of the problem.
Hi Ralph,
You've indeed found a problem, but not the one you think. You have
code like this, after preprocessing (and running it through indent):
({
struct EmulCaos MyCaos;
{
Object *_MUI_MakeObjectA_re;
MyCaos.reg_d0 = (unsigned long) (8);
MyCaos.r eg_a0 = (unsigned long) (unsigned long *) _tags;
MyCaos.reg_a6 = (unsigned long) MUIMasterBase;
MyCaos.caos_Un.Offset = (-0x78);
_MUI_MakeObjectA_re = (Object *) (*MyEmulHandle->EmulCallOS) (
&MyCaos);
_MUI_MakeObjectA_re;
}
})
The innermost set is not a statement-expression, it's simply a
statement. Statements don't have a return value. So the outermost
statement-expression is invalid (as the last thing in a
statement-expression must be an expression), and this is why the value
of the call is being discarded.
Really, GCC should produce an error for this code.
--
- Geoffrey Keating <geoffk@cygnus.com>