PR middle-end/14327
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Mar 2004 00:18:12 +0000 (00:18 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Mar 2004 00:18:12 +0000 (00:18 +0000)
        * 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
gcc/stmt.c
gcc/testsuite/gcc.c-torture/execute/20040302-1.c [new file with mode: 0644]

index 8bc1d5a..1a8e333 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-02  Richard Henderson  <rth@redhat.com>
+
+       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  <stcarrez@nerim.fr>
 
        * config/m68hc11/m68hc11.c (m68hc11_addr_mode): New variable.
index b3b1f1b..092720f 100644 (file)
@@ -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 (file)
index 0000000..07056c4
--- /dev/null
@@ -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;
+}