public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading
@ 2001-11-08 21:06 sirl
  0 siblings, 0 replies; 5+ messages in thread
From: sirl @ 2001-11-08 21:06 UTC (permalink / raw)
  To: abramsh, gcc-bugs, gcc-gnats, gcc-prs, nobody

Synopsis: dynamic_cast<>() fails in simple test case w/ dynamic loading

State-Changed-From-To: open->analyzed
State-Changed-By: sirl
State-Changed-When: Sat Nov 17 08:54:04 2001
State-Changed-Why:
    Reproduced on mainline and gcc-3_0-branch on powerpc-linux-gnu, regression from gcc-2.95.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading
@ 2001-12-04  6:56 nathan
  0 siblings, 0 replies; 5+ messages in thread
From: nathan @ 2001-12-04  6:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/3993; it has been noted by GNATS.

From: nathan@gcc.gnu.org
To: abramsh@acm.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
  gcc-prs@gcc.gnu.org, hubbard@ilm.com, jyost@ilm.com, kainz@ilm.com,
  nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading
Date: 4 Dec 2001 14:55:52 -0000

 Synopsis: dynamic_cast<>() fails in simple test case w/ dynamic loading
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: nathan
 State-Changed-When: Tue Dec  4 06:55:50 2001
 State-Changed-Why:
     user error, dynamic loading must merge symbols, so use
     RTLD_GLOBAL ... but that apparently still doesn't work and
     a new bug report 4993 has some sample code for that
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3993&database=gcc


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading
@ 2001-12-04  6:55 nathan
  0 siblings, 0 replies; 5+ messages in thread
From: nathan @ 2001-12-04  6:55 UTC (permalink / raw)
  To: abramsh, gcc-bugs, gcc-gnats, gcc-prs, hubbard, jyost, kainz, nobody

Synopsis: dynamic_cast<>() fails in simple test case w/ dynamic loading

State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Tue Dec  4 06:55:50 2001
State-Changed-Why:
    user error, dynamic loading must merge symbols, so use
    RTLD_GLOBAL ... but that apparently still doesn't work and
    a new bug report 4993 has some sample code for that

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading
@ 2001-11-08 22:56 sirl
  0 siblings, 0 replies; 5+ messages in thread
From: sirl @ 2001-11-08 22:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/3993; it has been noted by GNATS.

From: sirl@gcc.gnu.org
To: abramsh@acm.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
  gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading
Date: 17 Nov 2001 16:54:04 -0000

 Synopsis: dynamic_cast<>() fails in simple test case w/ dynamic loading
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: sirl
 State-Changed-When: Sat Nov 17 08:54:04 2001
 State-Changed-Why:
     Reproduced on mainline and gcc-3_0-branch on powerpc-linux-gnu, regression from gcc-2.95.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3993&database=gcc


^ permalink raw reply	[flat|nested] 5+ messages in thread

* c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading
@ 2001-08-10 22:56 abramsh
  0 siblings, 0 replies; 5+ messages in thread
From: abramsh @ 2001-08-10 22:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3993
>Category:       c++
>Synopsis:       dynamic_cast<>() fails in simple test case w/ dynamic loading
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 10 22:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Howard Abrams
>Release:        gcc version 3.0
>Organization:
>Environment:
Linux blah.voidstar.org 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
on i686-pc-linux-gnu
>Description:
When using "dlopen" to load a library, gcc seems to NOT merge
type_info symbols from the library. The result is dynamic
casts fail, as well as type_info::operator== for object that
they should not fail on. Below is simple source to reproduce
this problem.

Also note that on version 2.96 (Red Hat Linux 7.1 2.96-81)
(I know, you don't support that... ) this works fine.

>How-To-Repeat:
To reproduce this there are three small files. Compile with
the following two lines:

g++ -g -o test2.so -shared test2.cpp
g++ -g -o testcase test.cpp -ldl


The files are as follows:

classb.h
========
struct a
{
        virtual ~a() {}
};

struct b : public a
{
        virtual ~b() {}
};

test2.cpp
=========
#include <typeinfo>

#include "classb.h"

extern "C" {

a *getnewb() { return new b; }
const std::type_info &gettypeb() { return typeid( b ); }

}

test.cpp
========
#include <dlfcn.h>
#include <typeinfo>
#include <cassert>

#include "classb.h"

int main()
{
        a *(*func)(void);
        const std::type_info &(*type)(void);

        void *handle = dlopen( "test2.so", RTLD_NOW );
        func = (a *(*)(void))dlsym( handle, "getnewb" );
        type = (const std::type_info &(*)(void))dlsym( handle, "gettypeb" );

        a *a_ptr = (*func)();
        const std::type_info &t = (*type)();

        assert ( dynamic_cast<b*>( a_ptr ) );
        assert ( typeid( b ) == t );
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-12-04 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-08 21:06 c++/3993: dynamic_cast<>() fails in simple test case w/ dynamic loading sirl
  -- strict thread matches above, loose matches on Subject: below --
2001-12-04  6:56 nathan
2001-12-04  6:55 nathan
2001-11-08 22:56 sirl
2001-08-10 22:56 abramsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).