From f70783d06336dbd94c63f37dd5623d4ffdc2e4a5 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 5 Aug 2022 13:02:29 +0100 Subject: Update the type hasher to stop duplication of aggregate types The hasher we ported was always calling TYPE_HASH which ends up with DECL_UID which is geneated causing aggregate types keep having a unique hash which ends up confusing the middle end as two copy's of the same aggegate type ends up making GCC think there is some kind of type conversion required here. Fixes #1434 --- gcc/rust/backend/rust-compile-context.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gcc/rust/backend') diff --git a/gcc/rust/backend/rust-compile-context.cc b/gcc/rust/backend/rust-compile-context.cc index 463ac27..cb2addf6 100644 --- a/gcc/rust/backend/rust-compile-context.cc +++ b/gcc/rust/backend/rust-compile-context.cc @@ -62,9 +62,6 @@ Context::type_hasher (tree type) hstate.add_object (record_name_hash); } - if (TREE_TYPE (type)) - hstate.add_object (TYPE_HASH (TREE_TYPE (type))); - for (tree t = TYPE_ATTRIBUTES (type); t; t = TREE_CHAIN (t)) /* Just the identifier is adequate to distinguish. */ hstate.add_object (IDENTIFIER_HASH_VALUE (TREE_PURPOSE (t))); @@ -128,6 +125,16 @@ Context::type_hasher (tree type) } break; + case BOOLEAN_TYPE: + break; + + case REFERENCE_TYPE: + case POINTER_TYPE: { + hashval_t type_hash = type_hasher (TREE_TYPE (type)); + hstate.add_object (type_hash); + } + break; + default: break; } -- cgit v1.1