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]

Re: [PATCH] fixes to consistency.vlad/vlad.exp


On Mon, Aug 26, 2002 at 01:53:06PM -0400, Phil Edwards wrote:
> On Mon, Aug 26, 2002 at 07:15:56AM -0700, Janis Johnson wrote:
> > On Fri, Aug 23, 2002 at 09:11:18PM -0400, Phil Edwards wrote:
> > > On Fri, Aug 23, 2002 at 05:25:50PM -0700, Janis Johnson wrote:
> > > > C++ tests were built
> > > > using "gcc -x c++", which caused failures for tests with vtables, so now
> > > > they are built with g++ instead.
> > > 
> > > That seems worrying.
> > 
> > Tests class-*-and-virtual.cpp in consistency.vlad/layout all fail when
> > built with "gcc -x c++" rather than with "g++".
> > 
> > When built with gcc:
> > 
> >   /tmp/ccGpUaWO.o(.gnu.linkonce.d._ZTI3sss+0x0): undefined reference to
> >   `vtable for __cxxabiv1::__class_type_info'
> > 
> > When built with g++:
> > 
> >   laptop% nm a.out | fgrep class_type_info
> >            U _ZTVN10__cxxabiv117__class_type_infoE
> >   laptop% nm libstdc++.so | fgrep _ZTVN10__cxxabiv117__class_type_infoE
> >   0005fea0 W _ZTVN10__cxxabiv117__class_type_infoE
> 
> Ah, okay.  I thought you meant "vtables in general," not "vtables from
> the support section of the standard library."  This makes sense.
 
I don't know what the difference is.  Should this test link with
gcc -x c++?  In general, what kinds of C++ code that doesn't include
header files for the C++ Standard Library needs to be linked against
libstdc++?  Are there separate tests somewhere that use libsupc++
rather than libstdc++?

  #include <stdio.h>
  
  static class sss {
  public:
    int m;
    virtual int f (int i) {return i;}
  } sss;
  
  #define _offsetof(st,f) ((char *)&((st *) 16)->f - (char *) 16)
  
  int main (void) {
    printf ("+++Class starting with int and containing virtual function:\n");
    printf ("size=%d,align=%d\n", sizeof (sss), __alignof__ (sss));
    printf ("offset-m=%d,align-m=%d\n",
            _offsetof (class sss, m), __alignof__ (sss.m));
  }

Janis


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