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]
Other format: [Raw text]

[Committed] PR12092: Division by zero exception


The following patch resolves PR rtl-optimization/12092 on mainline
with is an ICE-on-valid regression caused by a division by zero.
This patch is the solution proposed by Jim Wilson in the posting
http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00567.html which was
his review of a patch by Andrew Pinski for the same problem,
http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00449.html

The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with
a top-level "make -k check" with no new failures.

Committed to mainline CVS.



2005-01-01  Roger Sayle  <roger@eyesopen.com>
	    Andrew Pinski  <pinskia@physics.uc.edu>
	    James E. Wilson  <wilson@specifixinc.com>

	PR rtl-optimization/12092
	* loop.c (emit_prefetch_instructions): Do nothing if PREFETCH_BLOCK
	is zero.

	* gcc.dg/pr12092-1.c: New test case.


Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.518
diff -c -3 -p -r1.518 loop.c
*** loop.c	18 Dec 2004 07:55:35 -0000	1.518
--- loop.c	1 Jan 2005 20:47:45 -0000
*************** emit_prefetch_instructions (struct loop
*** 4116,4122 ****
    struct prefetch_info info[MAX_PREFETCHES];
    struct loop_ivs *ivs = LOOP_IVS (loop);

!   if (!HAVE_prefetch)
      return;

    /* Consider only loops w/o calls.  When a call is done, the loop is probably
--- 4116,4122 ----
    struct prefetch_info info[MAX_PREFETCHES];
    struct loop_ivs *ivs = LOOP_IVS (loop);

!   if (!HAVE_prefetch || PREFETCH_BLOCK == 0)
      return;

    /* Consider only loops w/o calls.  When a call is done, the loop is probably


/* PR rtl-optimization/12092  */
/* Test case reduced by Andrew Pinski <pinskia@physics.uc.edu> */
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -mtune=i486 -march=pentium4 -fprefetch-loop-arrays" } */

void DecodeAC(int index,int *matrix)
{
  int *mptr;

  for(mptr=matrix+index;mptr<matrix+64;mptr++) {*mptr = 0;}
}


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


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