Actually check in the fix
authorH.J. Lu <hjl@gcc.gnu.org>
Wed, 4 Feb 2015 20:02:21 +0000 (12:02 -0800)
committerH.J. Lu <hjl@gcc.gnu.org>
Wed, 4 Feb 2015 20:02:21 +0000 (12:02 -0800)
From-SVN: r220416

gcc/lra-eliminations.c
gcc/testsuite/gcc.target/i386/pr64905.c [new file with mode: 0644]

index fe05a1f25274a57ee776732a1c949dfa8287e3e8..64eec4a003c81db7815fcd3f9e2dca66a99daaad 100644 (file)
@@ -182,6 +182,8 @@ setup_can_eliminate (struct lra_elim_table *ep, bool value)
   if (! value
       && ep->from == FRAME_POINTER_REGNUM && ep->to == STACK_POINTER_REGNUM)
     frame_pointer_needed = 1;
+  if (!frame_pointer_needed)
+    REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = 0;
 }
 
 /* Map: eliminable "from" register -> its current elimination,
diff --git a/gcc/testsuite/gcc.target/i386/pr64905.c b/gcc/testsuite/gcc.target/i386/pr64905.c
new file mode 100644 (file)
index 0000000..bc87d85
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-Os -ffixed-rax -ffixed-rbx -ffixed-rcx -ffixed-rdx -ffixed-rdi -ffixed-rsi -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12 -ffixed-r13 -ffixed-r14 -ffixed-r15" } */
+/* { dg-final { scan-assembler-not "movl\[ \t\]0\\(%.*\\), %.*" } } */
+
+typedef unsigned short uint16_t;
+uint16_t a_global;
+
+void __attribute__ ((noinline))
+function (uint16_t **a_p)
+{
+  // unaligned access by address in %rbp: mov    0x0(%rbp),%ebp
+  a_global = **a_p;
+}
+
+int main(int argc, char **argv)
+{
+  uint16_t array [4] = { 1, 2, 3, 4 };
+  uint16_t *array_elem_p = &array [3];
+
+  function (&array_elem_p);
+  return 0;
+}