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]

PATCH: fix java/parse.y crash


I was getting a compiler crash, with no diagnostics, while moving some
classes around.  It crashed in not_accessible_field_error when that
was passed a class, which it wasn't able to handle.

I tried to find a simple testcase, but I didn't pursue it very far.

Unless I hear objections, I'll check this into mainline in a few days.
I think it is probably also a good idea for 3.4.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


2004-02-05  Per Bothner  <per@bothner.com>

	* parse.y (resolve_qualified_expression_name):  In case of inaccessible
	class don't use not_accessible_field_error, which can get confused.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.466
diff -u -p -r1.466 parse.y
--- parse.y	27 Jan 2004 17:30:06 -0000	1.466
+++ parse.y	5 Feb 2004 19:55:16 -0000
@@ -9868,7 +9868,14 @@ resolve_qualified_expression_name (tree 
 	    }
 
 	  if (not_accessible_p (TREE_TYPE (decl), decl, type, 0))
- 	    return not_accessible_field_error (qual_wfl, decl);
+	    {
+	      parse_error_context
+		(qual_wfl, "Can't access %s class '%s' from '%s'",
+		 java_accstring_lookup (get_access_flags_from_decl (decl)),
+		 IDENTIFIER_POINTER (DECL_NAME (decl)),
+		 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
+	      return 1;
+	    }
 	  check_deprecation (qual_wfl, decl);
 
 	  type = TREE_TYPE (decl);

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