This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

java/12890: ICE on compilation of class with throwing method


This problem is caused by the confusing use of QUALIFIED_P.  In the
Java docs it says "True if ID is a qualified name (contains . or /)"
but gcj sets QUALIFIED_P unconditionally on the target of an import
statement.  So, any import statement of the type "import foo;" will
generate this error.  Of course, this is very unusual for Java
programs, because you should always define your own classes under
org.gnu.<blah> or com.sun.<blah>, etc.

For a fix, we could remove the unconditional setting of QUALIFIED_P in
process_imports().  That will at least match the documentation.
However, at this stage in the gcc process it's probably safer to check
the return value of breakdown_qualified().  Any use of
breakdown_qualified() that doesn't check the return value must be
regarded with suspicion.

Andrew.



2003-11-11  Andrew Haley  <aph@redhat.com>

	PR java/12890:
	* parse.y (do_resolve_class): Check return value from
	breakdown_qualified().

Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.452
diff -u -w -r1.452 parse.y
--- parse.y	3 Nov 2003 03:58:50 -0000	1.452
+++ parse.y	11 Nov 2003 16:12:20 -0000
@@ -5718,7 +5718,8 @@
 	 class and then treat Id as a member type.  If we can't find Q
 	 as a class then we fall through.  */
       tree q, left, left_type, right;
-      breakdown_qualified (&left, &right, TYPE_NAME (class_type));
+      if (breakdown_qualified (&left, &right, TYPE_NAME (class_type)) == 0)
+	{
       BUILD_PTR_FROM_NAME (left_type, left);
       q = do_resolve_class (enclosing, left_type, decl, cl);
       if (q)
@@ -5726,6 +5727,7 @@
 	  enclosing = q;
 	  saved_enclosing_type = TREE_TYPE (q);
 	  BUILD_PTR_FROM_NAME (class_type, right);
+	    }
 	}
     }
 


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