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