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]

C++ PATCH for c++/21123


The crash was due to trying to bitwise assign the result of the underlying function to the RESULT_DECL of the thunk instead of doing return slot magic which is necessary for C++ semantics. Fixed thus.

Tested x86_64-pc-linux-gnu, applied to trunk. I'll test and apply on 4.0 tomorrow. Test in g++.dg/inherit/thunk4.C.
2005-11-07  Jason Merrill  <jason@redhat.com>

	PR c++/21123
	* cp/method.c (use_thunk): Use build_cplus_new instead of 
	force_target_expr.

	* tree.h (CALL_FROM_THUNK_P): Add CALL_EXPR_CHECK.

Index: tree.h
===================================================================
*** tree.h	(revision 106609)
--- tree.h	(working copy)
*************** extern void tree_operand_check_failed (i
*** 1023,1029 ****
  
  /* In a CALL_EXPR, means that the call is the jump from a thunk to the
     thunked-to function.  */
! #define CALL_FROM_THUNK_P(NODE) ((NODE)->common.protected_flag)
  
  /* In a type, nonzero means that all objects of the type are guaranteed by the
     language or front-end to be properly aligned, so we can indicate that a MEM
--- 1023,1029 ----
  
  /* In a CALL_EXPR, means that the call is the jump from a thunk to the
     thunked-to function.  */
! #define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->common.protected_flag)
  
  /* In a type, nonzero means that all objects of the type are guaranteed by the
     language or front-end to be properly aligned, so we can indicate that a MEM
Index: cp/method.c
===================================================================
*** cp/method.c	(revision 106631)
--- cp/method.c	(working copy)
*************** use_thunk (tree thunk_fndecl, bool emit_
*** 502,508 ****
  		t = build3 (COND_EXPR, TREE_TYPE (t), cond, t,
  			    cp_convert (TREE_TYPE (t), integer_zero_node));
  	    }
! 	  t = force_target_expr (TREE_TYPE (t), t);
  	  finish_return_stmt (t);
  	}
  
--- 502,509 ----
  		t = build3 (COND_EXPR, TREE_TYPE (t), cond, t,
  			    cp_convert (TREE_TYPE (t), integer_zero_node));
  	    }
! 	  if (IS_AGGR_TYPE (TREE_TYPE (t)))
! 	    t = build_cplus_new (TREE_TYPE (t), t);
  	  finish_return_stmt (t);
  	}
  

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