From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3A801389040F; Thu, 24 Dec 2020 09:19:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A801389040F From: "samuel_benjamin at mentor dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98436] New: issue with casting member function on linux32 bit only Date: Thu, 24 Dec 2020 09:19:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 7.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: samuel_benjamin at mentor dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2020 09:19:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98436 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=3D49840&action=3Dedit 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 =3D &virtual table offset -134397620 on gcc-7.4.0 - 64 bit and many other gcc versions :=20 $1 =3D (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=