diff options
author | Andrew Haley <aph@redhat.com> | 2005-02-14 14:58:22 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2005-02-14 14:58:22 +0000 |
commit | 891df09c5617d2c3614404ef855da2dca72534a2 (patch) | |
tree | a661e23976ca842861dc949f3ed1a8516a828a76 /gcc/java/expr.c | |
parent | d633cfe524a361b4a5d1845e9b7fb78c2d813d7c (diff) | |
download | gcc-891df09c5617d2c3614404ef855da2dca72534a2.zip gcc-891df09c5617d2c3614404ef855da2dca72534a2.tar.gz gcc-891df09c5617d2c3614404ef855da2dca72534a2.tar.bz2 |
re PR java/19907 (Incorrect code generated for ManifestElement.java)
2005-02-14 Andrew Haley <aph@redhat.com>
PR java/19907
* expr.c (expand_byte_code): Call promote_arguments().
(promote_arguments): New function.
* decl.c (check_local_unnamed_variable): Remve special case for
new verifier.
(find_local_variable): Promote all boolean types to int
when searching for local variable decls.
From-SVN: r95015
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r-- | gcc/java/expr.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index a8ae7c6..7d51505 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -86,6 +86,7 @@ static void java_stack_pop (int); static tree build_java_throw_out_of_bounds_exception (tree); static tree build_java_check_indexed_type (tree, tree); static unsigned char peek_opcode_at_pc (struct JCF *, int, int); +static void promote_arguments (void); static GTY(()) tree operand_type[59]; @@ -2961,6 +2962,8 @@ expand_byte_code (JCF *jcf, tree method) return; } + promote_arguments (); + /* Translate bytecodes. */ linenumber_pointer = linenumber_table; for (PC = 0; PC < length;) @@ -3643,4 +3646,28 @@ build_java_empty_stmt (void) return t; } +/* Promote all args of integral type before generating any code. */ + +static void +promote_arguments (void) +{ + int i; + tree arg; + for (arg = DECL_ARGUMENTS (current_function_decl), i = 0; + arg != NULL_TREE; arg = TREE_CHAIN (arg), i++) + { + tree arg_type = TREE_TYPE (arg); + if (INTEGRAL_TYPE_P (arg_type) + && TYPE_PRECISION (arg_type) < 32) + { + tree copy = find_local_variable (i, integer_type_node, -1); + java_add_stmt (build2 (MODIFY_EXPR, integer_type_node, + copy, + fold_convert (integer_type_node, arg))); + } + if (TYPE_IS_WIDE (arg_type)) + i++; + } +} + #include "gt-java-expr.h" |