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]

Re: [C++] Fix 3130, 3131


On Friday 15 June 2001 15:44, Jason Merrill wrote:
> >>>>> "Nathan" == Nathan Sidwell <nathan@codesourcery.com> writes:
> >
> > Initially I tried to just change get_primary_binfo, to see if it could
> > find the canonical binfo, when given a choice, but that failed. The only
> > way I found to fix it was by allowing a canonical binfo to be inside
> > a non-canonical one.
>
> Please explain to me how this makes sense.  How can a canonical binfo be
> inside a non-canonical one?
>
> > *************** dfs_accumulate_vtbl_inits (binfo, orig_b
> > *** 7578,7587 ****
> >
> >   	      for (; b; b = BINFO_PRIMARY_BASE_OF (b))
> >   		{
> >   		  primary = b;
> >   		  orig_primary = BINFO_PRIMARY_BASE_OF (orig_primary);
> > - 		  if (b == rtti_binfo)
> > - 		    break;
> >   		}
> >   	    }
> >   	  else
> > --- 7669,7688 ----
> >
> >   	      for (; b; b = BINFO_PRIMARY_BASE_OF (b))
> >   		{
> > + 		  tree probe;
> > +
> > + 		  /* See if B is still within the hierarchy starting
> > + 		     at RTTI_BINFO. */
> > + 		  for (probe = b; probe;
> > + 		       probe = BINFO_INHERITANCE_CHAIN (probe))
> > + 		    if (probe == rtti_binfo)
> > + 		      break;
> > +
> > + 		  if (!probe)
> > + 		    break;
> > +
> >   		  primary = b;
> >   		  orig_primary = BINFO_PRIMARY_BASE_OF (orig_primary);
> >   		}
> >   	    }
> >   	  else
>
> Ah, I see.  My assumption that if the offsets matched, the hierarchy also
> matched, was wrong.  In Scott's second testcase, indirect primary vbase B
> is at offset 4 in D.  In F, it is still at offset 4 from D, but only
> because it is primary to E, which is laid out immediately after D.  So that
> test for case 1 doesn't work, and the case 1 handling should probably be
> folded back into the case 2 & 3 code; this test is case 2, but we're
> identifying it as case 1.
>
> Looking at the test for 3145, I notice an oddity whereby the primary base
> (C8) of a class (C9) has lost its own primary (C4).  This seems odd to me;
> I would have thought the primary base would have had priority, perhaps
> simply by treating the primary base as though it had been declared first.
> But, of course, it's too late to change this now.  I wish we had had more
> implementation experience before freezing the ABI...
>
> Your fix for 3145 seems wrong to me; the bug there is that orig_last
> tracking is broken in the fairly common case that the base we're primary to
> in T is different from that in BINFO_TYPE (RTTI_BINFO).  Here's my proposed
> patch, which does away with orig_last in favor of waiting until we're done
> with all the bases before trying to look at someone else's vtable pointer.
> It also fixes the extra space in 3145 (which, as you said, does not affect
> binary compatibility).  Look reasonable?  I'm going to go ahead and check
> it in after testing.
>
> 2001-06-15  Jason Merrill  <jason_merrill@redhat.com>
>
> 	* class.c (dfs_accumulate_vtbl_inits): Just point to the base we're
> 	sharing a ctor vtable with.  Merge code for cases 1 and 2.
> 	(binfo_ctor_vtable): New fn.
> 	(build_vtt_inits, dfs_build_secondary_vptr_vtt_inits): Use it.

Jason,

it seems that this checkin for gcc-3.0.1 breaks the arts package from 
kdelibs-2.1.2 on ppc-linux-gnu again:

creating artsd.all_cc.cc ...
g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../dcop -I../../libltdl 
-I../../kdecore -I../../kdeui -I../../kssl -I/usr/lib/qt-2.3.1/include 
-I/usr/X11R6/include   -I../../arts/mcop -I../../arts/flow    
-I../../arts/flow  -D_REENTRANT  -O2 -DNDEBUG -fno-exceptions -fno-check-new 
-Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings 
-Wno-long-long -Wnon-virtual-dtor -fno-builtin -O2 -fsigned-char 
-fno-exceptions -fno-check-new -DNDEBUG -UDEBUG -DNODEBUG 
-UDEBUG_ASYNC_TRANSFER -UVPORT_DEBUG -UDEBUG_IO -UDEBUG_MESSAGES -UDEBUG_AUTH 
-UDEBUG_CONNECTION_DATA -DYYDEBUG=0 -UNETWMDEBUG -UCSS_DEBUG 
-UCSS_STYLESHEET_DEBUG -USPEED_DEBUG -UKJS_DEBUGGER -UFORMS_DEBUG 
-UDEBUG_LAYOUT -UDEBUG_DRAW_BORDER -UPARSER_DEBUG -UDECODE_DEBUG 
-UCACHE_DEBUG -UBUFFER_DEBUG -UJPEG_DEBUG -UDEBUG_LINEBREAKS -UBOX_DEBUG 
-UTABLE_DEBUG -UYYERROR_VERBOSE -UKJS_DEBUG_MEM -UMIDIOUTDEBUG 
-UGENERAL_DEBUG_MESSAGES -D_GNU_SOURCE -frtti -DQT_CLEAN_NAMESPACE 
-DQT_NO_COMPAT -DQT_NO_ASCII_CAST  -c artsd.all_cc.cc
/bin/sh ../../libtool --mode=link --tag=CXX g++  -O2 -DNDEBUG -fno-exceptions 
-fno-check-new -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes 
-Wwrite-strings -Wno-long-long -Wnon-virtual-dtor -fno-builtin -O2 
-fsigned-char -fno-exceptions -fno-check-new -DNDEBUG -UDEBUG -DNODEBUG 
-UDEBUG_ASYNC_TRANSFER -UVPORT_DEBUG -UDEBUG_IO -UDEBUG_MESSAGES -UDEBUG_AUTH 
-UDEBUG_CONNECTION_DATA -DYYDEBUG=0 -UNETWMDEBUG -UCSS_DEBUG 
-UCSS_STYLESHEET_DEBUG -USPEED_DEBUG -UKJS_DEBUGGER -UFORMS_DEBUG 
-UDEBUG_LAYOUT -UDEBUG_DRAW_BORDER -UPARSER_DEBUG -UDECODE_DEBUG 
-UCACHE_DEBUG -UBUFFER_DEBUG -UJPEG_DEBUG -UDEBUG_LINEBREAKS -UBOX_DEBUG 
-UTABLE_DEBUG -UYYERROR_VERBOSE -UKJS_DEBUG_MEM -UMIDIOUTDEBUG 
-UGENERAL_DEBUG_MESSAGES -D_GNU_SOURCE -frtti -DQT_CLEAN_NAMESPACE 
-DQT_NO_COMPAT -DQT_NO_ASCII_CAST   -o artsd  artsd.all_cc.o  
libsoundserver_idl.la ../../arts/flow/libartsflow.la
g++ -O2 -DNDEBUG -fno-exceptions -fno-check-new -Wall -pedantic -W 
-Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long 
-Wnon-virtual-dtor -fno-builtin -O2 -fsigned-char -fno-exceptions 
-fno-check-new -DNDEBUG -UDEBUG -DNODEBUG -UDEBUG_ASYNC_TRANSFER 
-UVPORT_DEBUG -UDEBUG_IO -UDEBUG_MESSAGES -UDEBUG_AUTH 
-UDEBUG_CONNECTION_DATA -DYYDEBUG=0 -UNETWMDEBUG -UCSS_DEBUG 
-UCSS_STYLESHEET_DEBUG -USPEED_DEBUG -UKJS_DEBUGGER -UFORMS_DEBUG 
-UDEBUG_LAYOUT -UDEBUG_DRAW_BORDER -UPARSER_DEBUG -UDECODE_DEBUG 
-UCACHE_DEBUG -UBUFFER_DEBUG -UJPEG_DEBUG -UDEBUG_LINEBREAKS -UBOX_DEBUG 
-UTABLE_DEBUG -UYYERROR_VERBOSE -UKJS_DEBUG_MEM -UMIDIOUTDEBUG 
-UGENERAL_DEBUG_MESSAGES -D_GNU_SOURCE -frtti -DQT_CLEAN_NAMESPACE 
-DQT_NO_COMPAT -DQT_NO_ASCII_CAST -o .libs/artsd artsd.all_cc.o  
./.libs/libsoundserver_idl.so 
/cvsx/rawhide/BUILD/kdelibs-2.1.2/arts/soundserver/.libs/libkmedia2_idl.so 
-L/usr/lib/gcc-lib/ppc-linux/3.0.1 
-L/usr/lib/gcc-lib/ppc-linux/3.0.1/../../.. -lm -lm -lm -lgcc_s -lgcc -lc 
-lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc -lm 
-lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc 
-lm -lc -lgcc_s -lgcc -lm -lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s 
-lgcc -lc -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc -lm -lm -lm -lgcc_s -lgcc -lc 
-lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc -lm 
-lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc 
-lm -lc -lgcc_s -lgcc ../../arts/flow/.libs/libartsflow.so -lm -lm -lm 
-lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lc 
-lgcc_s -lgcc 
/cvsx/rawhide/BUILD/kdelibs-2.1.2/arts/flow/.libs/libartsflow_idl.so 
/cvsx/rawhide/BUILD/kdelibs-2.1.2/arts/mcop/.libs/libmcop.so -lpthread -ldl 
-lm -lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s 
-lgcc -lm -lc -lgcc_s -lgcc -lm -lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm 
-lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc -L/usr/X11R6/lib 
-L/usr/lib/qt-2.3.1/lib -L/usr/lib /usr/lib/libaudiofile.so -lm 
/usr/lib/libstdc++.so -lm -lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s 
-lgcc -lc -lgcc_s -lgcc -lm -lc -lgcc_s -lgcc
artsd.all_cc.o(.gnu.linkonce.s._ZTCN4Arts16SoundServer_implE52_NS_16SoundServer_skelE+0x204): 
undefined reference to `virtual thunk to 
Arts::SoundServer_base::_defaultPortsIn() const'
artsd.all_cc.o(.gnu.linkonce.s._ZTCN4Arts16SoundServer_implE52_NS_16SoundServer_skelE+0x208): 
undefined reference to `virtual thunk to 
Arts::SoundServer_base::_defaultPortsOut() const'
artsd.all_cc.o(.gnu.linkonce.s._ZTCN4Arts16SoundServer_implE52_NS_16SoundServer_skelE+0x20c): 
undefined reference to `virtual thunk to 
Arts::SoundServer_base::_cast(unsigned long)'
collect2: ld returned 1 exit status
make[1]: *** [artsd] Error 1
make[1]: Leaving directory 
`/cvsx/rawhide/BUILD/kdelibs-2.1.2/arts/soundserver'
make: *** [all-recursive] Error 1
[fsirl@enzo:/cvsx/rawhide/BUILD/kdelibs-2.1.2/arts]$ c++filt 
_ZTCN4Arts16SoundServer_implE52_NS_16SoundServer_skelE
construction vtable for Arts::SoundServer_skel-in-Arts::SoundServer_impl

Unfortunately I have no idea how to produce a testcase for this linking 
problem.

Franz.


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