public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9796: dynamic cast in shared library failed
@ 2003-02-22  0:06 raymond
  0 siblings, 0 replies; 3+ messages in thread
From: raymond @ 2003-02-22  0:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9796
>Category:       c++
>Synopsis:       dynamic cast in shared library failed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 22 00:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     raymond@cdlsystems.com
>Release:        GCC 3.2
>Organization:
>Environment:
linux
>Description:
When a class is created in the main function and passing it off to a shared library for downcasting, dynamic cast returns null.  

typedef void ( *PFN )( Parent* );

int main()
{
   Parent parent;
   Child child;
   void* pDl = dlopen ( "libshared.so",  
                        RTLD_GLOBAL|RTLD_NOW);
   PFN pfnAcquire = ( PFN )dlsym( pDl, "function1" );

   printf( "before %x %x\n", &child,  dynamic_cast<Child*>( &child ));
   pfnAcquire( &child );
}

In the acquired function from the shared library, if the same dynamic cast operation is done again, the result is always null.

When compiling the so file, -Wl,-E is used. See the attached script
 
>How-To-Repeat:
use the provided script to recompile the program and run it.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-zip-compressed; name="dynamiccast.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="dynamiccast.zip"

UEsDBBQAAAAIAC+CVS7gQl6EgwAAAKsAAAAKAAAAc2hhcmVkLmN4eE2NQQrCMBRE9/8UQ0RISxFc
K256gR5AkJCk9kP7I+mvVMS7SxDF2c3wHrNh8eMSIoxP05RkNxiiuGrMAtMauicO6Bfxykn2Fp3L
UbSGunyNioqeBOCWWbS3MCyYE7YrvJs1BmgpZzENCvbNR27+p/AQN7G/FO/YDjyG+mR/L9WBXvQG
UEsDBBQAAAAIAMuCVS6vh+4RlQAAADUBAAAIAAAAY29tbW9uLmiV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	[flat|nested] 3+ messages in thread

* Re: c++/9796: dynamic cast in shared library failed
@ 2003-02-24 19:15 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-02-24 19:15 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, raymond

Synopsis: dynamic cast in shared library failed

State-Changed-From-To: feedback->open
State-Changed-By: bangerth
State-Changed-When: Mon Feb 24 19:15:12 2003
State-Changed-Why:
    Feedback provided.
    
    Needs someone with knowledge of shared libraries and ldopen
    to investigate.

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


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

* Re: c++/9796: dynamic cast in shared library failed
@ 2003-02-22  0:32 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-02-22  0:32 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, raymond

Synopsis: dynamic cast in shared library failed

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Sat Feb 22 00:31:58 2003
State-Changed-Why:
    You didn't say which platform this is on. I guess, it is
    SPARC/Solaris, right? If so, we have about half a dozen
    such reports. It would be really helpful if the sparc
    maintainers could look at them eventually...

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


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

end of thread, other threads:[~2003-02-24 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-22  0:06 c++/9796: dynamic cast in shared library failed raymond
2003-02-22  0:32 bangerth
2003-02-24 19:15 bangerth

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).