This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: fix tree check failure in gcj
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 08 Dec 2001 23:36:16 -0700
- Subject: Patch: fix tree check failure in gcj
- Reply-to: tromey at redhat dot com
This code, from Jacks, causes a tree-checking failure in gcj.
public class T52n1 {
public static void main(String[] args) {
final int i = 1;
byte b = i;
}
}
The appended patch fixes this.
Ok?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* parse.y (try_builtin_assignconv): Don't pass a VAR_DECL to
int_fits_type_p.
* check-init.c (check_init): Don't allow pre- or post- increment
or decrement of final variable.
(final_assign_error): Minor error message rewording.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.331
diff -u -r1.331 parse.y
--- parse.y 2001/12/06 23:12:55 1.331
+++ parse.y 2001/12/09 06:29:32
@@ -12782,7 +12782,7 @@
&& (lhs_type == byte_type_node || lhs_type == char_type_node
|| lhs_type == short_type_node))
{
- if (int_fits_type_p (rhs, lhs_type))
+ if (int_fits_type_p (DECL_INITIAL (rhs), lhs_type))
new_rhs = convert (lhs_type, rhs);
else if (wfl_op1) /* Might be called with a NULL */
parse_warning_context