[committed] Avoid failure of gcc.c-torture/compile/pr42559.c on hppa*-*-*

John David Anglin dave@hiauly1.hia.nrc.ca
Mon Mar 22 06:44:00 GMT 2010


This patch avoids the divide by zero that occurs when the middle-end
passes a bogus alignment of zero to the PA movmem* expanders.  This
problem was fixed on the trunk but remains in the 4.4 and earlier
branches.

The attached patch was tested on hppa2.0w-hp-hpux11.11 and
hppa64-hp-hpux11.11.  Committed to trunk, 4.4 and 4.3.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2010-03-21  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle-end/42718
	* pa.md (movmemsi): Set align to one if zero.
	(movmemdi): Likewise.

Index: config/pa/pa.md
===================================================================
--- config/pa/pa.md	(revision 157544)
+++ config/pa/pa.md	(working copy)
@@ -3097,7 +3097,7 @@
 
   size = INTVAL (operands[2]);
   align = INTVAL (operands[3]);
-  align = align > 4 ? 4 : align;
+  align = align > 4 ? 4 : (align ? align : 1);
 
   /* If size/alignment is large, then use the library routines.  */
   if (size / align > 16)
@@ -3285,7 +3285,7 @@
 
   size = INTVAL (operands[2]);
   align = INTVAL (operands[3]);
-  align = align > 8 ? 8 : align;
+  align = align > 8 ? 8 : (align ? align : 1);
 
   /* If size/alignment is large, then use the library routines.  */
   if (size / align > 16)



More information about the Gcc-patches mailing list