OSDN Git Service

2002-03-29 Martin Kahlert <martin.kahlert@infineon.com>
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Mar 2002 22:27:29 +0000 (22:27 +0000)
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Mar 2002 22:27:29 +0000 (22:27 +0000)
* parse.y (do_resolve_class): Fix infinite recursion.

(http://gcc.gnu.org/ml/java/2002-03/msg00654.html)

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51578 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/java/ChangeLog
gcc/java/parse.y

index 5adea4c..c66f9a6 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-29  Martin Kahlert  <martin.kahlert@infineon.com>
+
+       * parse.y (do_resolve_class): Fix infinite recursion.
+
 2002-03-29  Tom Tromey  <tromey@redhat.com>
 
        * parse.y (check_inner_circular_reference): Ignore incomplete
index 6dccb3b..ef18d5f 100644 (file)
@@ -5868,18 +5868,20 @@ do_resolve_class (enclosing, class_type, decl, cl)
      applicable and use the matching DECL instead. */
   if (!decl_result && QUALIFIED_P (TYPE_NAME (class_type)))
     {
-      tree name = TYPE_NAME (class_type);
       char *separator;
+      tree name = TYPE_NAME (class_type);
+      char *namebuffer = alloca (IDENTIFIER_LENGTH (name) + 1);
+
+      strcpy (namebuffer, IDENTIFIER_POINTER (name));
+
       do {
 
        /* Reach the last '.', and if applicable, replace it by a `$' and
           see if this exists as a type. */
-       if ((separator = strrchr (IDENTIFIER_POINTER (name), '.')))
+       if ((separator = strrchr (namebuffer, '.')))
          {
-           int c = *separator;
            *separator = '$';
-           name = get_identifier (IDENTIFIER_POINTER (name));
-           *separator = c;
+           name = get_identifier (namebuffer);
            decl_result = IDENTIFIER_CLASS_VALUE (name);
          }
       } while (!decl_result && separator);