Commit c2c98445 by Tom Tromey Committed by Tom Tromey

class.c (build_static_field_ref): Only a String or numeric field can fold to a constant.

	* class.c (build_static_field_ref): Only a String or numeric field
	can fold to a constant.

From-SVN: r61723
parent 38997f1b
2003-01-24 Tom Tromey <tromey@redhat.com>
* class.c (build_static_field_ref): Only a String or numeric field
can fold to a constant.
2003-01-23 Tom Tromey <tromey@redhat.com>
* jcf-parse.c (parse_zip_file_entries): Overwrite trailing \0 of
......
......@@ -922,8 +922,18 @@ build_static_field_ref (tree fdecl)
tree fclass = DECL_CONTEXT (fdecl);
int is_compiled = is_compiled_class (fclass);
/* Allow static final fields to fold to a constant. */
if (is_compiled || FIELD_FINAL (fdecl))
/* Allow static final fields to fold to a constant. When using
-fno-assume-compiled, gcj will sometimes try to fold a field from
an uncompiled class. This is required when the field in question
meets the appropriate criteria for a compile-time constant.
However, currently sometimes gcj is too eager and will end up
returning the field itself, leading to an incorrect external
reference being generated. */
if (is_compiled
|| (FIELD_FINAL (fdecl) && DECL_INITIAL (fdecl) != NULL_TREE
&& (JSTRING_TYPE_P (TREE_TYPE (fdecl))
|| JNUMERIC_TYPE_P (TREE_TYPE (fdecl)))
&& TREE_CONSTANT (DECL_INITIAL (fdecl))))
{
if (!DECL_RTL_SET_P (fdecl))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment