This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g77 testsuite failures under hpux 10.20
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Subject: Re: g77 testsuite failures under hpux 10.20
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Fri, 7 Jul 2000 00:54:26 -0400 (EDT)
- Cc: law at cygnus dot com, gcc-bugs at gcc dot gnu dot org
> > In message <200007062319.TAA11417@hiauly1.hia.nrc.ca>you write:
> > > The obstack_grow call has walked over the rtl.
> > OK. This is odd since I don't think the RTL should have been allocated
> > in an obstack to begin with since RTL items are part of the garbage
> > collected memory, not obstacked memory.
>
> It appears that allocation in obstacked memory occurs if ggc_p is zero
> (cf, ggc.h:27):
>
> /* Language-specific code defines this variable to be either one (if
> it wants garbage collection), or zero (if it does not). */
> extern int ggc_p;
ggc_p is 1, so this is not the problem.
The string is allocated in obstacked memory in hppa_encode_label:
/* In HPUX 8.0's shared library scheme, special relocations are needed
for function labels if they might be passed to a function
in a shared library (because shared libraries don't live in code
space), and special magic is needed to construct their address.
For reasons too disgusting to describe storage for the new name
is allocated either on the saveable_obstack (released at function
exit) or on the permanent_obstack for things that can never change
(libcall names for example). */
void
hppa_encode_label (sym, permanent)
rtx sym;
int permanent;
{
const char *str = XSTR (sym, 0);
int len = strlen (str);
char *newstr;
newstr = obstack_alloc ((permanent ? &permanent_obstack : saveable_obstack),
len + 2);
if (str[0] == '*')
*newstr++ = *str++;
strcpy (newstr + 1, str);
*newstr = '@';
XSTR (sym,0) = newstr;
}
/* Construct a constant descriptor for the rtl-expression X.
It is up to the caller to enter the descriptor in the hash table. */
hppa_encode_label is called from make_decl_rtl as follows:
#0 hppa_encode_label (sym=0x40098108, permanent=0)
at ../../gcc/config/pa/pa.c:5963
#1 0x1afd9c in make_decl_rtl (decl=0x4009c700, asmspec=0x0, top_level=1)
at ../../gcc/varasm.c:829
Finally, the string allocated in hppa_encode_label is overwritten in
record_constant_rtx:
static struct constant_descriptor *
record_constant_rtx (mode, x)
enum machine_mode mode;
rtx x;
{
struct constant_descriptor *ptr;
char *label;
rtx rtl;
struct rtx_const value;
decode_rtx_const (mode, x, &value);
/* Put these things in the saveable obstack so we can ensure it won't
be freed if we are called from combine or some other phase that discards
memory allocated from function_obstack (current_obstack). */
obstack_grow (saveable_obstack, &ptr, sizeof ptr);
obstack_grow (saveable_obstack, &label, sizeof label);
obstack_grow (saveable_obstack, &rtl, sizeof rtl);
/* Record constant contents. */
obstack_grow (saveable_obstack, &value, sizeof value);
return (struct constant_descriptor *) obstack_finish (saveable_obstack);
}
If I was to guess, the obstack must be popped at some point, possibly
after the main program (this is where the @do_lio string is allocated).
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)