This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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: Infinitely long compilation


Hi Bryce,
turned out that the problem was fast to find out.
I do not know, how to make this patch correct in the gcc-way,
but it works for me. The problem is this:

If you have a name foo.bar you replace it by foo@bar,
try that for an identifier and then change the name back to foo.bar.
If it was not an identifier, do the same again....

Perhaps the line
*separator = c;
could simply be left out, but i do not know, whether the original name
will be used later. So i made the changes on a private copy.

Thanks for your help,
Martin.


PS: The patch is against gcc-20020325.

2002-03-28  Martin Kahlert  <martin.kahlert@infineon.com>

	* parse.y (do_resolve_class): Fix infinite recursion

--- parse.y.old	Thu Mar 28 08:33:56 2002
+++ parse.y	Thu Mar 28 08:50:42 2002
@@ -5852,18 +5852,22 @@
      applicable and use the matching DECL instead. */
   if (!decl_result && QUALIFIED_P (TYPE_NAME (class_type)))
     {
+      char *namebuffer;
+
       tree name = TYPE_NAME (class_type);
+
+      namebuffer = alloca(strlen(IDENTIFIER_POINTER (name))+1);
+      strcpy(namebuffer, IDENTIFIER_POINTER (name));
+
       char *separator;
       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);

-- 
The early bird catches the worm. If you want something else for       
breakfast, get up later.


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