misc.c (gnat_printable_name): Always return a copy in GC memory.
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 6 Nov 2008 11:42:52 +0000 (11:42 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 6 Nov 2008 11:42:52 +0000 (11:42 +0000)
* gcc-interface/misc.c (gnat_printable_name): Always return a copy
in GC memory.

From-SVN: r141638

gcc/ada/ChangeLog
gcc/ada/gcc-interface/misc.c

index 67300939fe0af3c6e2d97aea406c0521bcc2ebc3..5e9f8b719b1cbc0b681b75b0fefcd339fa8191ee 100644 (file)
@@ -1,3 +1,8 @@
+2008-11-06  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/misc.c (gnat_printable_name): Always return a copy
+       in GC memory.
+
 2008-11-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR ada/19419
index 7c7dc02f36fc7aeadd9b1ceac7bd121f2d0e118d..3026e9057b930f44140ce98a83f62dd473a5284b 100644 (file)
@@ -603,10 +603,10 @@ gnat_printable_name (tree decl, int verbosity)
   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