[Bug d/94240] [D] lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:215

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 7 16:31:29 GMT 2020


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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:

https://gcc.gnu.org/g:e926d076f28a91f3ea30bd0bcfa1f25958fdb59e

commit r9-8460-ge926d076f28a91f3ea30bd0bcfa1f25958fdb59e
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Tue Apr 7 18:02:47 2020 +0200

    d: Fix ICE in add_symbol_to_partition_1, at lto/lto-partition.c:215

    This patch addresses two problems with TypeInfo initializer generation.

    1. D array fields pointing to compiler generated data are referencing
    public symbols with no unique prefix, which can lead to duplicate
    definition errors in some hard to reduce cases.  To avoid name clashes,
    all symbols that are generated for TypeInfo initializers now use the
    assembler name of the TypeInfo decl as a prefix.

    2. An ICE would occur during LTO pass because these same decls are
    considered to be part of the same comdat group as the TypeInfo decl that
    it's referred by, despite itself being neither marked public nor comdat.
    This resulted in decls being added to the LTRANS partition out of order,
    triggering an assert when add_symbol_to_partition_1 attempted to add
    them again.  To remedy, TREE_PUBLIC and DECL_COMDAT are now set on all
    generated symbols.

    gcc/d/ChangeLog:

            PR d/94240
            * typeinfo.cc (class TypeInfoVisitor): Replace type_ field with
decl_.
            (TypeInfoVisitor::TypeInfoVisitor): Set decl_.
            (TypeInfoVisitor::result): Update.
            (TypeInfoVisitor::internal_reference): New function.
            (TypeInfoVisitor::layout_string): Use internal_reference.
            (TypeInfoVisitor::visit (TypeInfoTupleDeclaration *)): Likewise.
            (layout_typeinfo): Construct TypeInfoVisitor with typeinfo decl.
            (layout_classinfo): Likewise.


More information about the Gcc-bugs mailing list