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


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>

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