jcf-write.c (generate_bytecode_conditional): Correct handling of unordered conditionals.
authorBryce McKinlay <mckinlay@redhat.com>
Mon, 31 May 2004 14:54:37 +0000 (14:54 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Mon, 31 May 2004 14:54:37 +0000 (15:54 +0100)
* jcf-write.c (generate_bytecode_conditional): Correct handling
of unordered conditionals. Add comment.

From-SVN: r82485

gcc/java/ChangeLog
gcc/java/jcf-write.c

index 05d61d1b02bf3bad4553ebf5338d9561d21af0b7..0b1585a25264b3af64b46f2d5053015c792bafe0 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-31  Bryce McKinlay  <mckinlay@redhat.com>
+
+       * jcf-write.c (generate_bytecode_conditional): Correct handling
+       of unordered conditionals. Add comment.
+
 2004-05-29  Ranjit Mathew  <rmathew@hotmail.com>
             Per Bothner  <per@bothner.com>
 
index 5aa6d5ae4e6cbf0a0196509d7a6fbf46e88dd5e3..b04d55985d9731fc2b6b79ac9c77f93ab49bbf54 100644 (file)
@@ -1179,25 +1179,25 @@ generate_bytecode_conditional (tree exp,
       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 @@ generate_bytecode_conditional (tree exp,
     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;