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: [PATCH][C++] Fix dump-file corruption


On Sun, 2005-10-09 at 06:29 -0700, Mark Mitchell wrote:
> Richard Guenther wrote:
> 
> > Fixed by moving (swapping) a cached decls name to the position it would
> > have had if it had been freshly allocated.  This ensures that we can
> > reliably print strings with at least RING_SIZE decl names in them.
> 
> But, not with more names than that.  It's a bug to hold on to the memory
> returned by cxx_printable_name; you have to either print or copy the
> returned value immediately.  So, I don't think the bug is in
> cxx_printable_name; it sounds like the bug is in whatever part of the
> compiler is trying to hold on to those values.

I have to agree.
I believe the assumption all our name returning functions make is that
the memory they return is *not* yours to free or keep.
If you want your own copy, you have to make it.

At least, this is the assumption i've always worked under when dealing
with names (see tree-ssa-structalias.c :P)



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