diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/explow.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/split-7.c | 55 |
4 files changed, 66 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60aeafb..ad08f0f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-04 Ian Lance Taylor <iant@golang.org> + + * explow.c (allocate_dynamic_stack_space): Call + do_pending_stack_adjust before handling flag_split_stack. + 2016-10-04 David Malcolm <dmalcolm@redhat.com> * genattrtab.c (make_internal_attr): Supply dummy column number to diff --git a/gcc/explow.c b/gcc/explow.c index d8f9dd2..b56aea6 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -1357,6 +1357,8 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align, current_function_has_unbounded_dynamic_stack_size = 1; } + do_pending_stack_adjust (); + final_label = NULL; final_target = NULL_RTX; @@ -1414,8 +1416,6 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align, emit_label (available_label); } - do_pending_stack_adjust (); - /* We ought to be called always on the toplevel and stack ought to be aligned properly. */ gcc_assert (!(stack_pointer_delta diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 673b6f7..1725981 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-10-04 Ian Lance Taylor <iant@golang.org> + + * gcc.dg/split-7.c: New test. + 2016-10-04 Martin Sebor <msebor@redhat.com> * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Cast int argument to diff --git a/gcc/testsuite/gcc.dg/split-7.c b/gcc/testsuite/gcc.dg/split-7.c new file mode 100644 index 0000000..4933e9c --- /dev/null +++ b/gcc/testsuite/gcc.dg/split-7.c @@ -0,0 +1,55 @@ +/* { dg-do run } */ +/* { dg-require-effective-target split_stack } */ +/* { dg-options "-fsplit-stack -O2" } */ +/* { dg-options "-fsplit-stack -O2 -mno-accumulate-outgoing-args" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ + +/* A case that used to fail on 32-bit x86 when optimizing and not + using -maccumulate-args. The stack adjustment of the alloca got + mixed up with the arguments pushed on the stack to the function + before the call of alloca. */ + +#include <stdlib.h> + +typedef struct { const char* s; int l; } s; + +typedef unsigned long long align16 __attribute__ ((aligned(16))); + +s gobats (const void *, int) __attribute__ ((noinline)); + +s +gobats (const void* p __attribute__ ((unused)), + int l __attribute__ ((unused))) +{ + s v; + v.s = 0; + v.l = 0; + return v; +} + +void check_aligned (void *p) __attribute__ ((noinline)); + +void +check_aligned (void *p) +{ + if (((__SIZE_TYPE__) p & 0xf) != 0) + abort (); +} + +void gap (void *) __attribute__ ((noinline)); + +void gap (void *p) +{ + align16 a; + check_aligned (&a); +} + +int +main (int argc, char **argv) +{ + s *space; + gobats(0, 16); + space = (s *) alloca(sizeof(s) + 1); + *space = (s){0, 16}; + gap(space); + return 0; +} |