diff options
-rw-r--r-- | gcc/config/i386/i386.cc | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr109276.c | 13 |
2 files changed, 22 insertions, 1 deletions
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 669b1ef..85402f8 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -16557,10 +16557,18 @@ assign_386_stack_local (machine_mode mode, enum ix86_stack_slot n) if (s->mode == mode && s->n == n) return validize_mem (copy_rtx (s->rtl)); + int align = 0; + /* For DImode with SLOT_FLOATxFDI_387 use 32-bit + alignment with -m32 -mpreferred-stack-boundary=2. */ + if (mode == DImode + && !TARGET_64BIT + && n == SLOT_FLOATxFDI_387 + && ix86_preferred_stack_boundary < GET_MODE_ALIGNMENT (DImode)) + align = 32; s = ggc_alloc<stack_local_entry> (); s->n = n; s->mode = mode; - s->rtl = assign_stack_local (mode, GET_MODE_SIZE (mode), 0); + s->rtl = assign_stack_local (mode, GET_MODE_SIZE (mode), align); s->next = ix86_stack_locals; ix86_stack_locals = s; diff --git a/gcc/testsuite/gcc.target/i386/pr109276.c b/gcc/testsuite/gcc.target/i386/pr109276.c new file mode 100644 index 0000000..5d0827a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr109276.c @@ -0,0 +1,13 @@ +/* PR target/109276 */ +/* { dg-do compile } */ +/* { dg-options "-march=x86-64" } */ +/* { dg-additional-options "-mpreferred-stack-boundary=2" { target ia32 } } */ + +long long a; +long double b; + +void +foo (void) +{ + b += a; +} |