Leaf optimization/call stuff?

Richard Henderson rth@cygnus.com
Thu Apr 29 12:00:00 GMT 1999


On Thu, Apr 29, 1999 at 10:02:55AM -0700, Mark Mitchell wrote:
> 	  subl $8,%esp
> 	  addl $16,%esp
> 	  addl $-4,%esp
> 	  pushl $0
> 	  pushl $0
> 	  pushl $_A
> 	  call __1Aii

Whee.  The initialization code gen doesn't play by the rules --
that addl 16 is supposed to go at the end.

Here's a fix.


r~


	* decl2.c (do_static_initialization): Inhibit deferred pop.
	(do_static_destruction): Likewise.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.209
diff -c -p -d -r1.209 decl2.c
*** decl2.c	1999/04/29 08:33:43	1.209
--- decl2.c	1999/04/29 18:50:13
*************** do_static_initialization (decl, init, se
*** 3184,3189 ****
--- 3184,3190 ----
      start_sequence ();
    else
      push_to_sequence (pi->initialization_sequence);
+   NO_DEFER_POP;
  
    /* Tell the debugger that we are at the location of the static
       variable in question.  */
*************** do_static_initialization (decl, init, se
*** 3225,3230 ****
--- 3226,3232 ----
      expand_end_cond ();
  
    /* Save the sequence for later use.  */
+   OK_DEFER_POP;
    pi->initialization_sequence = get_insns ();
    end_sequence ();
  }
*************** do_static_destruction (decl, sentry, pri
*** 3255,3260 ****
--- 3257,3263 ----
      start_sequence ();
    else
      push_to_sequence (pi->destruction_sequence);
+   NO_DEFER_POP;
  
    /* Start a new sequence to handle just this destruction.  */
    start_sequence ();
*************** do_static_destruction (decl, sentry, pri
*** 3290,3295 ****
--- 3293,3299 ----
      emit_insn (new_insns);
  
    /* Save the sequence for later use.  */
+   OK_DEFER_POP;
    pi->destruction_sequence = get_insns ();
    end_sequence ();
  }


More information about the Gcc-bugs mailing list