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]

PATCH for vbase crash



Here's a patch for a crash on the attached test case.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

Index: testsuite/g++.old-deja/g++.other/cast1.C
===================================================================
RCS file: cast1.C
diff -N cast1.C
*** /dev/null	Mon Dec 31 20:00:00 1979
--- cast1.C	Fri Aug  7 09:27:41 1998
***************
*** 0 ****
--- 1,16 ----
+ // Build don't link:
+ 
+ struct S0 { };
+ struct S1 : virtual public S0 { };
+ struct S2 : virtual public S0 { };
+ 
+ struct S3 : public S1, public S2, virtual public S0
+ {
+ };
+ 
+ void f(const S0*) {}
+ 
+ void g()
+ {
+   f(static_cast<S3*>(0));
+ }
Index: cp/cvt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cvt.c,v
retrieving revision 1.23
diff -c -p -r1.23 cvt.c
*** cvt.c	1998/07/12 01:30:07	1.23
--- cvt.c	1998/08/07 16:27:46
*************** cp_convert_to_pointer (type, expr)
*** 154,160 ****
  	  && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
  	  && IS_AGGR_TYPE (TREE_TYPE (type))
  	  && IS_AGGR_TYPE (TREE_TYPE (intype))
! 	  && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
  	{
  	  enum tree_code code = PLUS_EXPR;
  	  tree binfo = get_binfo (TREE_TYPE (type), TREE_TYPE (intype), 1);
--- 154,168 ----
  	  && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
  	  && IS_AGGR_TYPE (TREE_TYPE (type))
  	  && IS_AGGR_TYPE (TREE_TYPE (intype))
! 	  && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE
! 	  /* If EXPR is NULL, then we don't need to do any arithmetic
! 	     to convert it:
! 
! 	       [conv.ptr]
! 
! 	       The null pointer value is converted to the null pointer
! 	       value of the destination type.  */
! 	  && !integer_zerop (expr))
  	{
  	  enum tree_code code = PLUS_EXPR;
  	  tree binfo = get_binfo (TREE_TYPE (type), TREE_TYPE (intype), 1);


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