diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-03-20 17:26:29 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-03-20 17:26:29 +0100 |
commit | b5446d0cc09e6a931065b98101d799711fd5b035 (patch) | |
tree | 6079d101665fcbf8ab836872e1164e5f5b6ffa2e /gcc/d/d-tree.h | |
parent | 1aa22b1916a493ac46453d96e0c78ca47bcaeda3 (diff) | |
download | gcc-b5446d0cc09e6a931065b98101d799711fd5b035.zip gcc-b5446d0cc09e6a931065b98101d799711fd5b035.tar.gz gcc-b5446d0cc09e6a931065b98101d799711fd5b035.tar.bz2 |
d: Fix SEGV in hash_table<odr_name_hasher, false, xcallocator>::find_slot_with_hash
This patch fixes LTO bug with the D front-end. As DECL_ASSEMBLER_NAME
is set on the TYPE_DECL, so TYPE_CXX_ODR_P must also be set on the type.
The addition of merge_aggregate_types is not strictly needed now, but it
fixes a problem introduced in newer versions of the dmd front-end where
templated types could be sent more than once to the D code generator.
gcc/d/ChangeLog:
2020-03-20 Iain Buclaw <ibuclaw@gdcproject.org>
PR lto/91027
* d-tree.h (struct GTY): Add daggregate field.
(IDENTIFIER_DAGGREGATE): Define.
(d_mangle_decl): Add declaration.
* decl.cc (mangle_decl): Remove static linkage, rename to...
(d_mangle_decl): ...this, update all callers.
* types.cc (merge_aggregate_types): New function.
(TypeVisitor::visit (TypeStruct *)): Call merge_aggregate_types, set
IDENTIFIER_DAGGREGATE and TYPE_CXX_ODR_P.
(TypeVisitor::visit (TypeClass *)): Likewise.
Diffstat (limited to 'gcc/d/d-tree.h')
-rw-r--r-- | gcc/d/d-tree.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/d/d-tree.h b/gcc/d/d-tree.h index 4e9c0b7..0f831c7 100644 --- a/gcc/d/d-tree.h +++ b/gcc/d/d-tree.h @@ -204,6 +204,7 @@ struct GTY(()) lang_identifier /* The frontend Declaration associated with this identifier. */ Declaration * GTY((skip)) dsymbol; + AggregateDeclaration * GTY((skip)) daggregate; }; #define IDENTIFIER_LANG_SPECIFIC(NODE) \ @@ -218,6 +219,9 @@ struct GTY(()) lang_identifier #define IDENTIFIER_DSYMBOL(NODE) \ (IDENTIFIER_LANG_SPECIFIC (NODE)->dsymbol) +#define IDENTIFIER_DAGGREGATE(NODE) \ + (IDENTIFIER_LANG_SPECIFIC (NODE)->daggregate) + /* Global state pertinent to the current function. */ struct GTY(()) language_function @@ -600,6 +604,7 @@ extern tree d_signed_type (tree); extern void d_keep (tree); /* In decl.cc. */ +extern const char *d_mangle_decl (Dsymbol *); extern tree mangle_internal_decl (Dsymbol *, const char *, const char *); extern void build_decl_tree (Dsymbol *); extern tree get_symbol_decl (Declaration *); |