Patchwork Fix PR middle-end/44843

login
register
mail settings
Submitter Eric Botcazou
Date July 8, 2010, 8:03 p.m.
Message ID <201007082203.10603.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/58290/
State New
Headers show

Comments

Eric Botcazou - July 8, 2010, 8:03 p.m.
As diagnosed by Richard G, there is a wrong assumption in the code handling 
MEM_REF in set_mem_attributes_minus_bitpos.  This replaces it with a much 
less wrong assumption, as suggested by Richard.

Tested on SPARC/Solaris and SPARC64/Solaris, applied on the mainline.


2010-07-08  Eric Botcazou  <ebotcazou@adacore.com>

	PR middle-end/44843
	* emit-rtl.c (set_mem_attributes_minus_bitpos): Do not rely on the
	pointed-to type of the offset in a MEM_REF to compute the alignment.


2010-07-08  Mikael Pettersson  <mikpe@it.uu.se>

	* gcc.c-torture/execute/20100708-1.c: New test.

Patch

Index: emit-rtl.c
===================================================================
--- emit-rtl.c	(revision 161961)
+++ emit-rtl.c	(working copy)
@@ -1634,10 +1634,9 @@  set_mem_attributes_minus_bitpos (rtx ref
 #endif
 	}
       else
-	/* This technically isn't correct.  We can't really derive
-	   alignment information from types.  */
-	align = MAX (align,
-		     TYPE_ALIGN (TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 1)))));
+	/* ??? This isn't fully correct, we can't set the alignment from the
+	   type in all cases.  */
+	align = MAX (align, TYPE_ALIGN (type));
 
       if (!integer_zerop (TREE_OPERAND (t, 1)) && aoff < align)
 	align = aoff;