This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/19295] [4.0 regression] Incorrect bytecode produced for bitwise AND


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]