re GNATS gcj/140 (gcj permits assignment to array length)

Fix for PR gcj/140:
	* parse.y (check_final_assignment): Recognize assignments to the
	`length' field of an array when generating class files.

From-SVN: r32960
This commit is contained in:
Tom Tromey 2000-04-06 05:29:30 +00:00 committed by Tom Tromey
parent 16d53b6439
commit bc2874c902
3 changed files with 26 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2000-04-05 Tom Tromey <tromey@cygnus.com>
Fix for PR gcj/140:
* parse.y (check_final_assignment): Recognize assignments to the
`length' field of an array when generating class files.
2000-04-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c (decl_hash): Prototype removed.

View File

@ -14053,10 +14053,16 @@ check_final_assignment (lvalue, wfl)
&& JDECL_P (TREE_OPERAND (lvalue, 1)))
lvalue = TREE_OPERAND (lvalue, 1);
if (TREE_CODE (lvalue) == FIELD_DECL
&& FIELD_FINAL (lvalue)
&& !DECL_CLINIT_P (current_function_decl)
&& !DECL_FINIT_P (current_function_decl))
/* When generating class files, references to the `length' field
look a bit different. */
if ((flag_emit_class_files
&& TREE_CODE (lvalue) == COMPONENT_REF
&& TYPE_ARRAY_P (TREE_TYPE (TREE_OPERAND (lvalue, 0)))
&& FIELD_FINAL (TREE_OPERAND (lvalue, 1)))
|| (TREE_CODE (lvalue) == FIELD_DECL
&& FIELD_FINAL (lvalue)
&& !DECL_CLINIT_P (current_function_decl)
&& !DECL_FINIT_P (current_function_decl)))
{
parse_error_context
(wfl, "Can't assign a value to the final variable `%s'",

View File

@ -11421,10 +11421,16 @@ check_final_assignment (lvalue, wfl)
&& JDECL_P (TREE_OPERAND (lvalue, 1)))
lvalue = TREE_OPERAND (lvalue, 1);
if (TREE_CODE (lvalue) == FIELD_DECL
&& FIELD_FINAL (lvalue)
&& !DECL_CLINIT_P (current_function_decl)
&& !DECL_FINIT_P (current_function_decl))
/* When generating class files, references to the `length' field
look a bit different. */
if ((flag_emit_class_files
&& TREE_CODE (lvalue) == COMPONENT_REF
&& TYPE_ARRAY_P (TREE_TYPE (TREE_OPERAND (lvalue, 0)))
&& FIELD_FINAL (TREE_OPERAND (lvalue, 1)))
|| (TREE_CODE (lvalue) == FIELD_DECL
&& FIELD_FINAL (lvalue)
&& !DECL_CLINIT_P (current_function_decl)
&& !DECL_FINIT_P (current_function_decl)))
{
parse_error_context
(wfl, "Can't assign a value to the final variable `%s'",