public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98436] New: issue with casting member function on linux32 bit only
@ 2020-12-24  9:19 samuel_benjamin at mentor dot com
  2020-12-24 10:04 ` [Bug c++/98436] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: samuel_benjamin at mentor dot com @ 2020-12-24  9:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98436

            Bug ID: 98436
           Summary: issue with casting member function on linux32 bit only
           Product: gcc
           Version: 7.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: samuel_benjamin at mentor dot com
  Target Milestone: ---

Created attachment 49840
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49840&action=edit
TestCase

There is an issue with gcc 7.4.0 linux32 bit only, I tried the example below
with 4.7.4 , 5.3.0. 6.3.0 , all are working fine for both 32bit and 64 bit
except gcc-7.4.0 linux32.

The issue is i have an un-implemented member function in a class , and the
implementation is inside another stub file.

The main exe loads two shared librares ( systemc.so ) and (systemc_stubs.so) ,
the issue arrives when i casts the undefined member function pointer is :

on gcc-7.4.0- 32 bit :

(gdb) p tmp
$1 = &virtual table offset -134397620


on gcc-7.4.0 - 64 bit and many other gcc versions : 
$1 = (void (functor::*)(functor * const)) 0x7ffff7e4c15a
     <_ZN7MyClass17myUndefinedMethodEv()>


Files are below :
Class.h --> basic class
testbench.cpp --> this is the main file for the fist so ( systemc.so)
stub.cpp --> systemc_stubs.so
main.cpp --> main exe which loads the 2 so and executes the entry point.

Compilation :
g++ -shared -o systemc.so -Wl,-E -Wl,-Bsymbolic -lm testbench.cpp -g
g++ -shared -o systemc_stubs.so -Wl,-E -Wl,-Bsymbolic -lm stub.cpp -g
g++ main.cpp -g -ldl -o testmain

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

end of thread, other threads:[~2020-12-25  0:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24  9:19 [Bug c++/98436] New: issue with casting member function on linux32 bit only samuel_benjamin at mentor dot com
2020-12-24 10:04 ` [Bug c++/98436] " pinskia at gcc dot gnu.org
2020-12-24 10:14 ` samuel_benjamin at mentor dot com
2020-12-24 11:15 ` pinskia at gcc dot gnu.org
2020-12-24 12:13 ` samuel_benjamin at mentor dot com
2020-12-24 12:18 ` samuel_benjamin at mentor dot com
2020-12-24 15:52 ` redi at gcc dot gnu.org
2020-12-25  0:20 ` pinskia at gcc dot gnu.org

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