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]
Other format: [Raw text]

Re: c++/8847: dynamic_cast segfaults with shared lib


Synopsis: dynamic_cast segfaults with shared lib

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Fri Dec  6 09:12:57 2002
State-Changed-Why:
    I can confirm the problem with a slightly smaller program:
    ------------------------------
    struct Foo {
      virtual ~Foo(){};
    };
    
    struct myBar : public Foo {
      virtual ~myBar(){};
    };
    
    int main(int, char **)
    {
      dynamic_cast<myBar *>((Foo*)new myBar());
    
      return 0;
    }
    ----------------------------------
    Linking with libGLU alone suffices to crash the program.
    
    However: on my system, which is very much like yours,
    libGLU and libGL are located in /usr/lib, i.e. are
    system libraries and are thus probably compiled with
    gcc 2.95. In contrast to libGL, libGLU has C++ symbols
    in it, so I am pretty sure that the problem stems from
    the ABI incompatibilities between the 2.95 C++ compiler
    and the 3.2 C++ compiler. This has to be expected. Linking
    C++ libraries together that have not been created with the
    same compiler asks for trouble (or at least did, prior to
    the standard gcc is trying to follow since 3.2). Can you
    report what happens if you try to use a libGLU that is
    compiled with the same compiler as the one you use
    for the rest of the project, i.e. 3.2.1?
    
    Thanks
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8847


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