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/decl.cc | |
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/decl.cc')
-rw-r--r-- | gcc/d/decl.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index 7afb1aa..053d553 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -59,8 +59,8 @@ along with GCC; see the file COPYING3. If not see /* Return identifier for the external mangled name of DECL. */ -static const char * -mangle_decl (Dsymbol *decl) +const char * +d_mangle_decl (Dsymbol *decl) { if (decl->isFuncDeclaration ()) return mangleExact ((FuncDeclaration *)decl); @@ -78,7 +78,7 @@ mangle_decl (Dsymbol *decl) tree mangle_internal_decl (Dsymbol *decl, const char *name, const char *suffix) { - const char *prefix = mangle_decl (decl); + const char *prefix = d_mangle_decl (decl); unsigned namelen = strlen (name); unsigned buflen = (2 + strlen (prefix) + namelen + strlen (suffix)) * 2; char *buf = (char *) alloca (buflen); @@ -1145,7 +1145,7 @@ get_symbol_decl (Declaration *decl) if (decl->mangleOverride) mangled_name = get_identifier (decl->mangleOverride); else - mangled_name = get_identifier (mangle_decl (decl)); + mangled_name = get_identifier (d_mangle_decl (decl)); mangled_name = targetm.mangle_decl_assembler_name (decl->csym, mangled_name); @@ -2333,7 +2333,7 @@ build_type_decl (tree type, Dsymbol *dsym) tree decl = build_decl (make_location_t (dsym->loc), TYPE_DECL, get_identifier (name), type); - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (mangle_decl (dsym))); + SET_DECL_ASSEMBLER_NAME (decl, get_identifier (d_mangle_decl (dsym))); TREE_PUBLIC (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_CONTEXT (decl) = d_decl_context (dsym); |