This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
two patches for better jc1 error handling
- From: Per Bothner <per at bothner dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 08 Mar 2002 22:18:44 -0800
- Subject: two patches for better jc1 error handling
The first patch is needed to recover from bad assignments
like:
String x = 30;
The second patch is needed to catch errors like:
String x = 0;
There are other ways to solve the problem, but I don't see
any reason for a special case for 0 so I removed it.
Fixing this triggers a few problems in libjava where
0 is assigned to RawData fields. The ones I've come
across so far are in gnu.gcj.xlib. Before I check this
patch in, I'll fix those (and run the testsuite).
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
2002-03-08 Per Bothner <per@bothner.com>
* parse.y (java_complete_lhs): Check if patch_assignment
returned an error-mark.
* parse.y (try_builtin_assignconv): Don't special-case zero.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.356
diff -u -p -r1.356 parse.y
--- parse.y 2002/03/03 14:07:32 1.356
+++ parse.y 2002/03/09 03:33:34
@@ -12104,6 +12104,8 @@ java_complete_lhs (node)
else
{
node = patch_assignment (node, wfl_op1);
+ if (node == error_mark_node)
+ return error_mark_node;
/* Reorganize the tree if necessary. */
if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node))
|| JSTRING_P (TREE_TYPE (node))))
@@ -12802,12 +12804,6 @@ try_builtin_assignconv (wfl_op1, lhs_typ
&& TREE_CODE (lhs_type) == BOOLEAN_TYPE)
new_rhs = rhs;
}
-
- /* Zero accepted everywhere */
- else if (TREE_CODE (rhs) == INTEGER_CST
- && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0
- && JPRIMITIVE_TYPE_P (rhs_type))
- new_rhs = convert (lhs_type, rhs);
/* 5.1.1 Try Identity Conversion,
5.1.2 Try Widening Primitive Conversion */