This is the mail archive of the gcc-patches@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]

Java patch: fix integer division folds, take 2



My last "fix" worked, but was the wrong fix.  The real problem here is
that JINTEGRAL_TYPE_P was being misapplied.  Thanks for the pointer
Richard!  And here's a better patch.. 

Wed Oct 24 16:21:32 2001  Anthony Green  <green@redhat.com>

	* parse.y (patch_binop): Fix JINTEGRAL_TYPE_P usage.

Index: gcc/java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.321
diff -u -p -r1.321 parse.y
--- parse.y	2001/10/11 23:50:48	1.321
+++ parse.y	2001/10/24 22:44:37
@@ -13542,7 +13543,7 @@ patch_binop (node, wfl_op1, wfl_op2)
          simplifications like (1-1)/3. We can't do that with floating
          point number, folds can't handle them at this stage. */
       if (code == RDIV_EXPR && TREE_CONSTANT (op1) && TREE_CONSTANT (op2)
-	  && JINTEGRAL_TYPE_P (op1) && JINTEGRAL_TYPE_P (op2))
+	  && JINTEGRAL_TYPE_P (TREE_TYPE (op1)) && JINTEGRAL_TYPE_P (TREE_TYPE (op2)))
 	{
 	  TREE_TYPE (node) = prom_type;
 	  node = fold (node);


AG

-- 
Anthony Green                                                        Red Hat
                                                       Sunnyvale, California


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