This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PATCH: fix java/parse.y crash
- From: Per Bothner <per at bothner dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, java-patches at gcc dot gnu dot org
- Date: Thu, 05 Feb 2004 12:40:17 -0800
- Subject: 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);