public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Gary Thomas: Re: Code generation bug in GCC-2.8.0
@ 1998-02-09 14:46 David Edelsohn
  1998-02-10  3:34 ` Gary Thomas
  0 siblings, 1 reply; 2+ messages in thread
From: David Edelsohn @ 1998-02-09 14:46 UTC (permalink / raw)
  To: Jeffrey Law; +Cc: egcs

	Some more discussion about the SVR4 PPC inlining problem which has
not been cc'ed to the egcs mailinglist follows.  I am not enough of an
expert about this aspect of GCC and the SVR4 port to assess whether it is
correct.  It is a lot simpler and less intrusive than the original patch,
and limited to rs6000 SVR4 port.

David

------- Forwarded Message

Date: Mon, 09 Feb 1998 15:37:54 +0100 (MET)
Organization: The Open Group / Research Institute
Sender: gdt@gr.opengroup.org
From: Gary Thomas <g.thomas@opengroup.org>
To: (Richard Kenner) <kenner@vlsi1.ultra.nyu.edu>
Subject: Re:  Code generation bug in GCC-2.8.0
Cc: meissner@cygnus.com, dje@watson.ibm.com

On 09-Feb-98 Richard Kenner wrote:
> Since varargs functions don't get inlined, I'm confused how this came up,
> but any, the simplest fix is:
> 
> Mon Feb  9 07:57:14 1998  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
> 
>       * rs6000.c (setup_incoming_varargs): Always set rs6000_sysv_varargs_p.
> 
> *** config/rs6000/rs6000.c.old        Thu Dec 25 13:07:01 1997
> --- config/rs6000/rs6000.c    Mon Feb  9 08:52:36 1998
> *************** setup_incoming_varargs (cum, mode, type,
> *** 1487,1495 ****
>            cum->words, cum->fregno, cum->nargs_prototype, cum->prototype,
> GET_MODE_NAME (mode), no_rtl);
>   
> !   if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && !no_rtl)
>       {
>         rs6000_sysv_varargs_p = 1;
> !       save_area = plus_constant (frame_pointer_rtx, RS6000_VARARGS_OFFSET);
>       }
>   
>     if (cum->words < 8)
> --- 1487,1498 ----
>            cum->words, cum->fregno, cum->nargs_prototype, cum->prototype,
> GET_MODE_NAME (mode), no_rtl);
>   
> !   if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
>       {
>         rs6000_sysv_varargs_p = 1;
> !       if (! no_rtl)
> !     save_area = plus_constant (frame_pointer_rtx, RS6000_VARARGS_OFFSET);
>       }
> +   else
> +     rs6000_sysv_varargs_p = 0;
>   
>     if (cum->words < 8)

I don't see how this can fix the problem sice this function is only executed 
when the function is being declared, not when the code is being generated.
The routine in question (the user routine with varargs) only has it's code
output at the end of processing the entire file, long after the declaration
was processed (and indeed many others potentially processed in between).

I actually observed that it executed the assignment on line 1492 when the
declaration came along, but since this is a "static" variable whose scope
is the current function declaration, it is incorrect whe the code is output.
The purpose of the save/restore procedures is to preserve this type of
information with the function definition so that it can be made available
when the code is finally generated.  Perhaps there are better ways to do
this (I could think of some), but I was just trying to reuse/mimick the
way Mike had addressed the problem originally for nested functions.

>>>>> Richard Kenner writes at Mon, 9 Feb 98 10:15:08 EST:

Nope.  It's called when you go back to a previously-inlined function.
Indeed, it's called for *precisely* this sort of thing.

------- End of Forwarded Message


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Gary Thomas: Re: Code generation bug in GCC-2.8.0
  1998-02-09 14:46 Gary Thomas: Re: Code generation bug in GCC-2.8.0 David Edelsohn
@ 1998-02-10  3:34 ` Gary Thomas
  0 siblings, 0 replies; 2+ messages in thread
From: Gary Thomas @ 1998-02-10  3:34 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Jeffrey Law, egcs

David Edelsohn wrote:
> 
>         Some more discussion about the SVR4 PPC inlining problem which has
> not been cc'ed to the egcs mailinglist follows.  I am not enough of an
> expert about this aspect of GCC and the SVR4 port to assess whether it is
> correct.  It is a lot simpler and less intrusive than the original patch,
> and limited to rs6000 SVR4 port.
> 
> David
> 

Indeed this patch is much more refined and fixes the problem.
Thanks to Richard Kenner for distilling it.

> ------- Forwarded Message
> 
> Date: Mon, 09 Feb 1998 15:37:54 +0100 (MET)
> Organization: The Open Group / Research Institute
> Sender: gdt@gr.opengroup.org
> From: Gary Thomas <g.thomas@opengroup.org>
> To: (Richard Kenner) <kenner@vlsi1.ultra.nyu.edu>
> Subject: Re:  Code generation bug in GCC-2.8.0
> Cc: meissner@cygnus.com, dje@watson.ibm.com
> 
> On 09-Feb-98 Richard Kenner wrote:
> > Since varargs functions don't get inlined, I'm confused how this came up,
> > but any, the simplest fix is:
> >
> > Mon Feb  9 07:57:14 1998  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
> >
> >       * rs6000.c (setup_incoming_varargs): Always set rs6000_sysv_varargs_p.
> >
> > *** config/rs6000/rs6000.c.old        Thu Dec 25 13:07:01 1997
> > --- config/rs6000/rs6000.c    Mon Feb  9 08:52:36 1998
> > *************** setup_incoming_varargs (cum, mode, type,
> > *** 1487,1495 ****
> >            cum->words, cum->fregno, cum->nargs_prototype, cum->prototype,
> > GET_MODE_NAME (mode), no_rtl);
> >
> > !   if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && !no_rtl)
> >       {
> >         rs6000_sysv_varargs_p = 1;
> > !       save_area = plus_constant (frame_pointer_rtx, RS6000_VARARGS_OFFSET);
> >       }
> >
> >     if (cum->words < 8)
> > --- 1487,1498 ----
> >            cum->words, cum->fregno, cum->nargs_prototype, cum->prototype,
> > GET_MODE_NAME (mode), no_rtl);
> >
> > !   if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
> >       {
> >         rs6000_sysv_varargs_p = 1;
> > !       if (! no_rtl)
> > !     save_area = plus_constant (frame_pointer_rtx, RS6000_VARARGS_OFFSET);
> >       }
> > +   else
> > +     rs6000_sysv_varargs_p = 0;
> >
> >     if (cum->words < 8)
> 
> I don't see how this can fix the problem sice this function is only executed
> when the function is being declared, not when the code is being generated.
> The routine in question (the user routine with varargs) only has it's code
> output at the end of processing the entire file, long after the declaration
> was processed (and indeed many others potentially processed in between).
> 
> I actually observed that it executed the assignment on line 1492 when the
> declaration came along, but since this is a "static" variable whose scope
> is the current function declaration, it is incorrect whe the code is output.
> The purpose of the save/restore procedures is to preserve this type of
> information with the function definition so that it can be made available
> when the code is finally generated.  Perhaps there are better ways to do
> this (I could think of some), but I was just trying to reuse/mimick the
> way Mike had addressed the problem originally for nested functions.
> 
> >>>>> Richard Kenner writes at Mon, 9 Feb 98 10:15:08 EST:
> 
> Nope.  It's called when you go back to a previously-inlined function.
> Indeed, it's called for *precisely* this sort of thing.
> 
> ------- End of Forwarded Message

-- 
------------------------------------------------------------------------
Gary Thomas                              |
The Open Group / Research Institute      | "Fine wine is a necessity of
2 Avenue de Vignate                      |        life for me"
38610 Gieres - FRANCE                    |
+33 4 76 63 48 74                        |      Thomas Jefferson
email: g.thomas@opengroup.org            |
< http://www.opengroup.org/~gdt >          |
   ... opinions expressed here are mine  |
       and no one else would claim them! |
------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-02-10  3:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-09 14:46 Gary Thomas: Re: Code generation bug in GCC-2.8.0 David Edelsohn
1998-02-10  3:34 ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).