From e554ec7f6acc9a4f2bffcc8c8e5dbd57f1a3c73b Mon Sep 17 00:00:00 2001 From: rth Date: Wed, 3 Mar 2004 00:18:12 +0000 Subject: [PATCH] PR middle-end/14327 * stmt.c (expand_computed_goto): Do do_pending_stack_adjust before emitting the label, not after. * gcc.c-torture/execute/20040302-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78798 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/stmt.c | 2 +- gcc/testsuite/gcc.c-torture/execute/20040302-1.c | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20040302-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8bc1d5a..1a8e333 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-03-02 Richard Henderson + + PR middle-end/14327 + * stmt.c (expand_computed_goto): Do do_pending_stack_adjust before + emitting the label, not after. + 2004-03-02 Stephane Carrez * config/m68hc11/m68hc11.c (m68hc11_addr_mode): New variable. diff --git a/gcc/stmt.c b/gcc/stmt.c index b3b1f1b..092720f 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -524,9 +524,9 @@ expand_computed_goto (tree exp) { cfun->computed_goto_common_reg = copy_to_mode_reg (Pmode, x); cfun->computed_goto_common_label = gen_label_rtx (); - emit_label (cfun->computed_goto_common_label); do_pending_stack_adjust (); + emit_label (cfun->computed_goto_common_label); emit_indirect_jump (cfun->computed_goto_common_reg); current_function_has_computed_jump = 1; diff --git a/gcc/testsuite/gcc.c-torture/execute/20040302-1.c b/gcc/testsuite/gcc.c-torture/execute/20040302-1.c new file mode 100644 index 0000000..07056c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20040302-1.c @@ -0,0 +1,24 @@ +int code[]={0,0,0,0,1}; + +void foo(int x) { + volatile int b; + b = 0xffffffff; +} + +void bar(int *pc) { + static const void *l[] = {&&lab0, &&end}; + + foo(0); + goto *l[*pc]; + lab0: + foo(0); + pc++; + goto *l[*pc]; + end: + return; +} + +int main() { + bar(code); + return 0; +} -- 2.7.4