[PATCH] PR java/15769 infinite loop

Andrew Pinski pinskia@physics.uc.edu
Thu Jun 3 17:52:00 GMT 2004


Just like C/C++ front-end change which Zack committed/tested for me,
the Java front-end had forgot to add the unordered tree codes to the
list of tree codes which act as comparisons to truthvalue_conversion
language hook when the new tree codes were added.
The C/C++ change is referenced here:
<http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01458.html>

Thanks,
Andrew Pinski

Testcase:
class bug15769 {
	private boolean foo () { return false; }

	public boolean bar (double blaz)
	{	
		return (Double.POSITIVE_INFINITY != blaz) && foo ();
	}
}


ChangeLog:
         * expr.c (java_truthvalue_conversion): Handle
         UNEQ_EXPR, UNLE_EXPR, UNGE_EXPR, UNLT_EXPR, UNGT_EXPR,
         ORDERED_EXPR, and UNORDERED_EXPR as comparison operators,
         i.e. return the expression.


Patch:
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.191
diff -u -p -r1.191 expr.c
--- expr.c	14 May 2004 02:29:32 -0000	1.191
+++ expr.c	3 Jun 2004 17:33:41 -0000
@@ -160,12 +160,16 @@ java_truthvalue_conversion (tree expr)

    switch (TREE_CODE (expr))
      {
-    case EQ_EXPR:
-    case NE_EXPR: case LE_EXPR: case GE_EXPR: case LT_EXPR: case 
GT_EXPR:
+    case EQ_EXPR:   case NE_EXPR:   case UNEQ_EXPR: case LTGT_EXPR:
+    case LE_EXPR:   case GE_EXPR:   case LT_EXPR:   case GT_EXPR:
+    case UNLE_EXPR: case UNGE_EXPR: case UNLT_EXPR: case UNGT_EXPR:
+    case ORDERED_EXPR: case UNORDERED_EXPR:
      case TRUTH_ANDIF_EXPR:
      case TRUTH_ORIF_EXPR:
      case TRUTH_AND_EXPR:
      case TRUTH_OR_EXPR:
+    case TRUTH_XOR_EXPR:
+    case TRUTH_NOT_EXPR:
      case ERROR_MARK:
        return expr;



More information about the Java-patches mailing list