java/4715
Tom Tromey
tromey@redhat.com
Thu Dec 20 22:46:00 GMT 2001
The following reply was made to PR java/4715; it has been noted by GNATS.
From: Tom Tromey <tromey@redhat.com>
To: Bryce McKinlay <bryce@waitaki.otago.ac.nz>
Cc: gcc-gnats@gcc.gnu.org
Subject: java/4715
Date: 20 Dec 2001 23:43:17 -0700
I looked at this PR a bit tonight. I didn't really get very far.
This scenario seems too complex to figure out in one night (for me
anyway).
It wasn't clear to me that simply returning NULL_TREE when we
encountered an incomplete type was correct. I came up with the
appended patch, which seems to work. However, I don't vouch for its
correctness.
Tom
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.338
diff -u -r1.338 parse.y
--- parse.y 2001/12/21 05:28:27 1.338
+++ parse.y 2001/12/21 06:29:48
@@ -5232,14 +5232,23 @@
if (!basetype_vec)
return NULL_TREE;
-
+
for (i = 0; i < TREE_VEC_LENGTH (basetype_vec); i++)
{
- tree su = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
+ tree su;
+
+ /* We can end up with a NULL_TREE or an incomplete type here if
+ we are compiling multiple files at once. It's safe to simply
+ ignore these cases. */
+ if (TREE_VEC_ELT (basetype_vec, i) == NULL_TREE)
+ continue;
+ su = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
+ if (INCOMPLETE_TYPE_P (su))
+ continue;
if (inherits_from_p (su, target))
return lookup_cl (TYPE_NAME (su));
-
+
for (ctx = DECL_CONTEXT (TYPE_NAME (su)); ctx; ctx = DECL_CONTEXT (ctx))
{
/* An enclosing context shouldn't be TARGET */
More information about the Gcc-prs
mailing list