Commit d5f62555 by Roger Sayle Committed by Roger Sayle

re PR java/19295 (Incorrect bytecode produced for bitwise AND)


	PR java/19295
	* jcf-write.c (generate_bytecode_insns): Conversions between
	integer types of the same precision shouldn't generate widening
	or narrowing conversion bytecodes.

	* testsuite/libjava.compile/PR19295.java: New test case.

From-SVN: r94162
parent e930780c
2005-01-24 Roger Sayle <roger@eyesopen.com>
PR java/19295
* jcf-write.c (generate_bytecode_insns): Conversions between
integer types of the same precision shouldn't generate widening
or narrowing conversion bytecodes.
2005-01-22 Kazu Hirata <kazu@cs.umass.edu>
* java-except.h, java-tree.h: Remove unused prototypes.
......
......@@ -2260,42 +2260,50 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
}
else /* Convert numeric types. */
{
int wide_src = TYPE_PRECISION (src_type) > 32;
int wide_dst = TYPE_PRECISION (dst_type) > 32;
NOTE_POP (1 + wide_src);
RESERVE (1);
int src_prec = TYPE_PRECISION (src_type);
int dst_prec = TYPE_PRECISION (dst_type);
int wide_src = src_prec > 32;
int wide_dst = dst_prec > 32;
if (TREE_CODE (dst_type) == REAL_TYPE)
{
NOTE_POP (1 + wide_src);
RESERVE (1);
if (TREE_CODE (src_type) == REAL_TYPE)
OP1 (wide_dst ? OPCODE_f2d : OPCODE_d2f);
else if (TYPE_PRECISION (src_type) == 64)
else if (src_prec == 64)
OP1 (OPCODE_l2f + wide_dst);
else
OP1 (OPCODE_i2f + wide_dst);
NOTE_PUSH (1 + wide_dst);
}
else /* Convert to integral type. */
/* Convert to integral type (but ignore non-widening
and non-narrowing integer type conversions). */
else if (TREE_CODE (src_type) == REAL_TYPE
|| src_prec != dst_prec)
{
NOTE_POP (1 + wide_src);
RESERVE (1);
if (TREE_CODE (src_type) == REAL_TYPE)
OP1 (OPCODE_f2i + wide_dst + 3 * wide_src);
else if (wide_dst)
OP1 (OPCODE_i2l);
else if (wide_src)
OP1 (OPCODE_l2i);
if (TYPE_PRECISION (dst_type) < 32)
if (dst_prec < 32)
{
RESERVE (1);
/* Already converted to int, if needed. */
if (TYPE_PRECISION (dst_type) <= 8)
if (dst_prec <= 8)
OP1 (OPCODE_i2b);
else if (TYPE_UNSIGNED (dst_type))
OP1 (OPCODE_i2c);
else
OP1 (OPCODE_i2s);
}
}
NOTE_PUSH (1 + wide_dst);
}
}
}
break;
case TRY_EXPR:
......
2005-01-24 Roger Sayle <roger@eyesopen.com>
PR java/19295
* testsuite/libjava.compile/PR19295.java: New test case.
2005-01-19 Tom Tromey <tromey@redhat.com>
* java/lang/VMCompiler.java (compileClass): Ignore UnknownError.
......
public class PR19295 implements myInterface {
public long tagBits = 0;
public final boolean isArrayType() {
return (tagBits & IsArrayType) != 0;
}
}
abstract class blah {
public final static int Bit1 = 0x2;
}
interface myInterface {
long IsArrayType = blah.Bit1;
}
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