[Bug c++/98261] Wrong optimize for virtual function

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Dec 13 21:54:30 GMT 2020


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The bug reporting guidelines tell you to try -fsanitize=undefined before
reporting a bug. That would have told you your code is wrong:

A
d.C:26:14: runtime error: member call on address 0x7ffe71274e18 which does not
point to an object of type 'A'
0x7ffe71274e18: note: object is of type 'B'
 00 00 00 00  28 20 40 00 00 00 00 00  40 20 40 00 00 00 00 00  18 4e 27 71 fe
7f 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'B'
B


More information about the Gcc-bugs mailing list