[Bug ipa/120098] [13/14/15 Regression] g++.dg/lto/devirt-23 FAILs since r16-372-g064cac730f88dc

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 3 16:53:02 GMT 2026


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

--- Comment #31 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:522e0c0bdabfa39f2c3bfc3f7a3d3c2b60b62381

commit r15-11240-g522e0c0bdabfa39f2c3bfc3f7a3d3c2b60b62381
Author: Jan Hubicka <hubicka@ucw.cz>
Date:   Fri Apr 17 17:34:35 2026 +0200

    Fix handling of anonymous type vtables in ipa-devirt

    Solve first problem discussed in PR120098 where modified
    devirt-23 testcase leads to wrong code.  The testcase triggers situation
    whre anonymous type MultiTermDocs is derived by C.  When we look for
possible
    polymorphic call targets, we special case anonymous type and check if they
    have been instantiated by looking if their virtual table is used at all.
    In this case it is not, however C has construction vtable which refers to
    MultiTermDocs's virtual function.

    Since we have no easy way to go from a type to all construction vtables
    of its derived types, this is fixed by adding a walk of variables
    and noting them.  Walk is triggered lazilly only when such anonymous types
    exists.

    gcc/ChangeLog:

            PR ipa/120098
            * ipa-devirt.cc (odr_type_p): Add no_derived_construction_vtables
            (odr_types_ptr): Move ahead in file.
            (odr_types): Move ahead in file.
            (anonymous_construction_vtable_p): New function.
            (mark_derived_construction_vtables): New function.
            (construction_vtable_hook): New function.
            (type_possibly_instantiated_p): Watch for construction vtables.

    gcc/testsuite/ChangeLog:

            PR ipa/120098
            * g++.dg/torture/pr120098.C: New test.

    (cherry picked from commit 5e492f27e44c052237a7296d7fb754bae5755982)


More information about the Gcc-bugs mailing list