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]

[Ada] Fix printing of function names in dumps


The problem is that gnat_printable_name returns the address of a static buffer 
in some cases.

Tested on x86_64-suse-linux, applied on the mainline.


2008-11-06 ?Eric Botcazou ?<ebotcazou@adacore.com>

	* gcc-interface/misc.c (gnat_printable_name): Always return a copy
	in GC memory.


-- 
Eric Botcazou
Index: gcc-interface/misc.c
===================================================================
--- gcc-interface/misc.c	(revision 141548)
+++ gcc-interface/misc.c	(working copy)
@@ -603,10 +603,10 @@ gnat_printable_name (tree decl, int verb
   if (verbosity == 2)
     {
       Set_Identifier_Casing (ada_name, (char *) DECL_SOURCE_FILE (decl));
-      ada_name = Name_Buffer;
+      return ggc_strdup (Name_Buffer);
     }
-
-  return (const char *) ada_name;
+  else
+    return ada_name;
 }
 
 /* Expands GNAT-specific GCC tree nodes.  The only ones we support

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