This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/19295] [4.0 regression] Incorrect bytecode produced for bitwise AND
- From: "tromey at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jan 2005 20:00:04 -0000
- Subject: [Bug java/19295] [4.0 regression] Incorrect bytecode produced for bitwise AND
- References: <20050106191430.19295.overholt@redhat.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tromey at gcc dot gnu dot org 2005-01-06 20:00 -------
I've investigated this a little.
The bug does not occur with gcj 3.3 or 3.4, so I am marking
it as a regression.
The trouble starts in fold_single_bit_test(). Here we transform
"tagBits & IsArrayType" into a new expression involving some
casts and an RSHIFT_EXPR.
The immediate problem seems to be that one of the casts looks like:
<nop_expr <unsigned long> <long>>
In this situation jcf-write emits i2l, which is incorrect.
Overall this is another instance of "we shouldn't use fold in gcj".
One possible fix might be to make fold_single_bit_test conditional
on the can_use_bit_fields_p langhook.
Another might be to change jcf-write to handle this sort of cast,
though I wonder if this can really be done safely.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|Incorrect bytecode produced |[4.0 regression] Incorrect
|for bitwise AND |bytecode produced for
| |bitwise AND
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19295