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]

Overflow problem in loop


gcc.c-torture/execute/loop-2b.c triggers an overflow bug in loop.  It
tries to replace (INT_MAX-1) by (INT_MAX-1) * 4 + reg, which is obviously
invalid.


1999-03-14  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* loop.c (maybe_eliminate_biv_1): Disable the remaining biv
	elimination inside comparison.

--- egcs-2.93/gcc/loop.c.~2~	Mon Mar  1 22:23:17 1999
+++ egcs-2.93/gcc/loop.c	Sun Mar 14 16:47:09 1999
@@ -8325,7 +8325,8 @@
 	{
 	  /* First try to replace with any giv that has constant positive
 	     mult_val and constant add_val.  We might be able to support
-	     negative mult_val, but it seems complex to do it in general.  */
+	     negative mult_val, but it seems complex to do it in general.
+	     ??? Disabled due to possible overflow.  */
 
 	  for (v = bl->giv; v; v = v->next_iv)
 	    if (CONSTANT_P (v->mult_val) && INTVAL (v->mult_val) > 0
@@ -8335,7 +8336,8 @@
 		    || (GET_CODE (v->add_val) == REG
 			&& REGNO_POINTER_FLAG (REGNO (v->add_val))))
 		&& ! v->ignore && ! v->maybe_dead && v->always_computable
-		&& v->mode == mode)
+		&& v->mode == mode
+		&& 0)
 	      {
 		if (! biv_elimination_giv_has_0_offset (bl->biv, v, insn))
 		  continue;

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org


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