This is the mail archive of the gcc-bugs@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]

PATCH for vaargs/templates problems



Template functions making use of stdarg.h (like that in
g++.pt/vaarg.C), could not be compiled -g on some systems, like
Solaris 2.6.  The bug was actually platform-independent, but the
Solaris va_arg macros were hairy enough to cause the bug.  Here's a
patch. 

Thanks to Gerald for providing access to his Solaris machines to help
me track this down!

Jason, is this all right?

-- 
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available

Sun Mar 15 22:36:21 1998  Mark Mitchell  <mmitchell@usa.net>

	* pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more
	closely mimics the behavior in parse.y.
	(tsubst_expr): Return the resuting BLOCK when making a tsubst'ing
	into a compound statement.
	
cvs server: Diffing .
Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.91
diff -c -p -r1.91 pt.c
*** pt.c	1998/03/15 19:53:08	1.91
--- pt.c	1998/03/16 06:31:30
*************** tsubst_copy (t, args, in_decl)
*** 4553,4563 ****
  	       build_expr_from_tree.  So, we need to expand the
  	       BIND_EXPR here.  */ 
  	    tree rtl_exp = expand_start_stmt_expr();
! 	    tsubst_expr (TREE_OPERAND (r, 1), args, in_decl);
  	    rtl_exp = expand_end_stmt_expr (rtl_exp);
  	    TREE_SIDE_EFFECTS (rtl_exp) = 1;
! 	    return build (BIND_EXPR, TREE_TYPE (rtl_exp), 
! 			  NULL_TREE, rtl_exp, TREE_OPERAND (r, 2));
  	  }
  
  	return r;
--- 4553,4564 ----
  	       build_expr_from_tree.  So, we need to expand the
  	       BIND_EXPR here.  */ 
  	    tree rtl_exp = expand_start_stmt_expr();
! 	    tree block = tsubst_expr (TREE_OPERAND (r, 1), args, in_decl);
  	    rtl_exp = expand_end_stmt_expr (rtl_exp);
  	    TREE_SIDE_EFFECTS (rtl_exp) = 1;
! 	    r = build (BIND_EXPR, TREE_TYPE (rtl_exp), 
! 		       NULL_TREE, rtl_exp, block);
! 	    delete_block (block);
  	  }
  
  	return r;
*************** tsubst_expr (t, args, in_decl)
*** 4841,4847 ****
  	  tsubst_expr (substmt, args, in_decl);
  
  	if (COMPOUND_STMT_NO_SCOPE (t) == 0)
! 	  do_poplevel ();
        }
        break;
  
--- 4842,4848 ----
  	  tsubst_expr (substmt, args, in_decl);
  
  	if (COMPOUND_STMT_NO_SCOPE (t) == 0)
! 	  return do_poplevel ();
        }
        break;
  
cvs server: Diffing inc


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