aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2010-07-08 20:02:29 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-07-08 20:02:29 +0000
commit5951297a1afe3039a9716f2cb6ee924a7a388f37 (patch)
tree8561750a6a97c6dd5d05bb878f503d6f22c85867
parent5653ef60cbffdbca50d277f61612665c60d0e66d (diff)
downloadgcc-5951297a1afe3039a9716f2cb6ee924a7a388f37.zip
gcc-5951297a1afe3039a9716f2cb6ee924a7a388f37.tar.gz
gcc-5951297a1afe3039a9716f2cb6ee924a7a388f37.tar.bz2
re PR middle-end/44843 (All 32-bit fortran execution tests generate unaligned access)
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. From-SVN: r161974
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/emit-rtl.c7
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20100708-1.c29
4 files changed, 42 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b0b5361..c9c5fc9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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 Kai Tietz <kai.tietz@onevision.com>
* final.c (final_scan_insn): Replace
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 42bb429..da7677a 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1634,10 +1634,9 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
#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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ed315e..4fe7194 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-08 Mikael Pettersson <mikpe@it.uu.se>
+
+ * gcc.c-torture/execute/20100708-1.c: New test.
+
2010-07-08 Jakub Jelinek <jakub@redhat.com>
PR fortran/44847
diff --git a/gcc/testsuite/gcc.c-torture/execute/20100708-1.c b/gcc/testsuite/gcc.c-torture/execute/20100708-1.c
new file mode 100644
index 0000000..590a94a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20100708-1.c
@@ -0,0 +1,29 @@
+/* PR middle-end/44843 */
+/* Verify that we don't use the alignment of struct S for inner accesses. */
+
+struct S
+{
+ double for_alignment;
+ struct { int x, y, z; } a[16];
+};
+
+void f(struct S *s) __attribute__((noinline));
+
+void f(struct S *s)
+{
+ unsigned int i;
+
+ for (i = 0; i < 16; ++i)
+ {
+ s->a[i].x = 0;
+ s->a[i].y = 0;
+ s->a[i].z = 0;
+ }
+}
+
+int main (void)
+{
+ struct S s;
+ f (&s);
+ return 0;
+}