This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: Allow cgraph nodes to change name


> Date: Tue, 19 Aug 2003 08:49:26 +0200
> From: Jan Hubicka <hubicka@ucw.cz>

> > Jan Hubicka <hubicka@ucw.cz> writes:
> > 
> > > Hi,
> > > in hammer branch we run into testcase where function name changes in the
> > > middle of process totally messing up the cgraph hashtables.  The
> > > testcase does not reproduce on mainline as the function is no longer
> > > localized, but I guess the problem remains.  The attached patch fixes
> > > it.  OK?
> > > 
> > > Mon Aug 18 10:12:57 CEST 2003  Jan Hubicka   <jh@suse.cz>
> > > 	* cgraph.c (cgraph_set_decl_assembler_name): New function.
> > > 	* cgraph.h (cgraph_set_decl_assembler_name): Declare.
> > > 	* varasm.c (make_decl_rtl): Use it.
> > 
> > I think a better approach would be to ensure that function's assembler
> > names are set exactly once, rather than being set (to the wrong value)
> > and then changed later.  I fixed a bunch of places where this was done
> > recently, and so far as I know this is the last place.
> 
> It may be also possible to simply produce RTL name before we insert the
> node, but I was under impression that for C++ it is expensive to produce
> it and that is why we do so lazily on demand.

This won't work if the RTL name is wrong.  The problem here is that
even in C, when you have

extern void foo (void) asm ("bar");

then DECL_ASSEMBLER_NAME starts off by being set to "foo", and then
later is changed to "bar".  Naturally, this confuses the cgraph code
(and intermodule analysis, and weak symbols, and everywhere else that
tries to look at the assembler name).

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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