This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix 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.

Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.347
diff -c -p -d -r1.347 stmt.c
*** stmt.c	26 Feb 2004 23:49:17 -0000	1.347
--- stmt.c	3 Mar 2004 00:15:06 -0000
*************** expand_computed_goto (tree exp)
*** 524,532 ****
      {
        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_indirect_jump (cfun->computed_goto_common_reg);
  
        current_function_has_computed_jump = 1;
--- 524,532 ----
      {
        cfun->computed_goto_common_reg = copy_to_mode_reg (Pmode, x);
        cfun->computed_goto_common_label = gen_label_rtx ();
  
        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;
Index: testsuite/gcc.c-torture/execute/20040302-1.c
===================================================================
RCS file: testsuite/gcc.c-torture/execute/20040302-1.c
diff -N testsuite/gcc.c-torture/execute/20040302-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.c-torture/execute/20040302-1.c	3 Mar 2004 00:15:07 -0000
***************
*** 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;
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]