This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Java: Fix jcf-write fold() fallout
Per Bothner wrote:
Bryce McKinlay wrote:
Does this look correct?
Looks plausible.
A comment would be nice. Something like:
UNLT_EXPR(a, b) means 'a < b || unordered(a, b)'. This is the same
as the Java source expression '!(a >= b)', so handle it that way.
Thanks Per. I'm checking in the patch below.
Regards
Bryce
2004-05-31 Bryce McKinlay <mckinlay@redhat.com>
* jcf-write.c (generate_bytecode_conditional): Correct handling
of unordered conditionals. Add comment.
Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.145
diff -u -r1.145 jcf-write.c
--- jcf-write.c 28 May 2004 23:59:49 -0000 1.145
+++ jcf-write.c 31 May 2004 14:53:17 -0000
@@ -1179,25 +1179,25 @@
op = OPCODE_if_icmpne;
goto compare;
- case UNLT_EXPR:
+ case UNLE_EXPR:
unordered = 1;
case GT_EXPR:
op = OPCODE_if_icmpgt;
goto compare;
- case UNGT_EXPR:
+ case UNGE_EXPR:
unordered = 1;
case LT_EXPR:
op = OPCODE_if_icmplt;
goto compare;
- case UNLE_EXPR:
+ case UNLT_EXPR:
unordered = 1;
case GE_EXPR:
op = OPCODE_if_icmpge;
goto compare;
- case UNGE_EXPR:
+ case UNGT_EXPR:
unordered = 1;
case LE_EXPR:
op = OPCODE_if_icmple;
@@ -1206,6 +1206,9 @@
compare:
if (unordered)
{
+ /* UNLT_EXPR(a, b) means 'a < b || unordered(a, b)'. This is
+ the same as the Java source expression '!(a >= b)', so handle
+ it that way. */
struct jcf_block *tmp = true_label;
true_label = false_label;
false_label = tmp;