]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: Fix ICE in add_symbol_to_partition_1, at lto/lto-partition.c:215
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 7 Apr 2020 16:02:47 +0000 (18:02 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Tue, 7 Apr 2020 16:02:47 +0000 (18:02 +0200)
commite926d076f28a91f3ea30bd0bcfa1f25958fdb59e
treebbb4539e85142d99b26a1ceffe9424e8e4f6a360
parent1168240fbe41ee509795a67d5b9107f233d17df9
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.
gcc/d/ChangeLog
gcc/d/typeinfo.cc