expr.c (pop_type_0): Save the result of the first lang_printable_name call in a scrat...
authorZack Weinberg <zackw@stanford.edu>
Tue, 3 Apr 2001 01:01:41 +0000 (01:01 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Tue, 3 Apr 2001 01:01:41 +0000 (01:01 +0000)
* expr.c (pop_type_0): Save the result of the first
lang_printable_name call in a scratch buffer, so it
won't be clobbered by the second call.

From-SVN: r41032

gcc/java/ChangeLog
gcc/java/expr.c

index e9f24dfb876c1702fecafaa6b0f0fedf6393d3c6..ac8ee1c8ce18759f9e5379ea9756fe50a4aa120e 100644 (file)
@@ -1,3 +1,9 @@
+2001-04-02  Zack Weinberg  <zackw@stanford.edu>
+
+       * expr.c (pop_type_0): Save the result of the first
+       lang_printable_name call in a scratch buffer, so it 
+       won't be clobbered by the second call.
+
 2001-03-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * expr.c (pop_type_0): Call `concat' rather than building the
index 2ea6a81352697042281c7037e3ce3baa369f7017..cb9ae160931f5aefef7d93934096d99cfdd1891a 100644 (file)
@@ -356,9 +356,15 @@ pop_type_0 (type, messagep)
        return object_ptr_type_node;
     }
 
-  *messagep = concat ("expected type '", lang_printable_name (type, 0),
-                     "' but stack contains '", lang_printable_name (t, 0),
-                     "'", NULL);
+  /* lang_printable_name uses a static buffer, so we must save the result
+     from calling it the first time.  */
+  {
+    char *temp = xstrdup (lang_printable_name (type, 0));
+    *messagep = concat ("expected type '", temp,
+                       "' but stack contains '", lang_printable_name (t, 0),
+                       "'", NULL);
+    free (temp);
+  }
   return type;
 }