[gnu.g++.bug] GNU C++ 1.36.1 loses on Sun3

tiemann@SUN.COM (Michael Tiemann) (11/18/89)

This should help people with problems like this:

	f(_,_,_, new Foo)		// works ("new Foo" pushed first)
	f(_,_, new Foo, _)		// doesn't
	t = new Foo;  f(_,_,t,_)	// does
// For anyone having the same problem: compiling with -fno-defer-pop
// will provide a temporary workaround...

If anybody has been using -fno-defer-pop as a preventative measure on
Sun3, please try these fixes and see if -fno-defer-pop is still
neccessary for correct behavior.  This should also cure the problem of
some functions starting out with mysterious pops.  Thanks,

Michael

teacake% diff -c2 cplus-init.c~ cplus-init.c
*** cplus-init.c~	Sat Nov 18 05:12:57 1989
--- cplus-init.c	Sat Nov 18 05:42:56 1989
***************
*** 2603,2606 ****
--- 2603,2607 ----
  
  	  TREE_TYPE (xval) = TREE_TYPE (rval);
+ 	  do_pending_stack_adjust ();
  	  start_sequence ();
  
***************
*** 2615,2620 ****
  	    expand_aggr_init (build_indirect_ref (rval, 0), init, 0);
  
  	  TREE_VOLATILE (xval) = 1;
- 	  emit_insn (gen_sequence ());
  	  RTL_EXPR_SEQUENCE (xval) = get_insns ();
  	  end_sequence ();
--- 2616,2622 ----
  	    expand_aggr_init (build_indirect_ref (rval, 0), init, 0);
  
+ 	  do_pending_stack_adjust ();
+ 
  	  TREE_VOLATILE (xval) = 1;
  	  RTL_EXPR_SEQUENCE (xval) = get_insns ();
  	  end_sequence ();
***************
*** 3414,3417 ****
--- 3416,3420 ----
        TREE_TYPE (rval) = void_type_node;
  
+       do_pending_stack_adjust ();
        start_sequence ();
        emit_note (0, -1);
***************
*** 3420,3425 ****
  			 dtor_dummy, auto_delete_vec,
  			 auto_delete);
        TREE_VOLATILE (rval) = 1;
-       emit_insn (gen_sequence ());
        RTL_EXPR_SEQUENCE (rval) = get_insns ();
        end_sequence ();
--- 3423,3429 ----
  			 dtor_dummy, auto_delete_vec,
  			 auto_delete);
+       do_pending_stack_adjust ();
+ 
        TREE_VOLATILE (rval) = 1;
        RTL_EXPR_SEQUENCE (rval) = get_insns ();
        end_sequence ();
teacake%