This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Infinitely long compilation
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- To: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Cc: java at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Thu, 28 Mar 2002 08:55:07 +0100
- Subject: Re: Infinitely long compilation
- References: <20020328074505.A20123@keksy.muc.infineon.com> <3CA2C261.3080409@waitaki.otago.ac.nz>
- Reply-to: martin dot kahlert at infineon dot com
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.