From e8ce63b1e31b5c99171b463dc191253b64a82b45 Mon Sep 17 00:00:00 2001 From: marxin Date: Mon, 4 Nov 2019 09:11:26 +0000 Subject: [PATCH] Fix hash_operand for fields of a CONSTRUCTOR. 2019-11-04 Martin Liska PR ipa/92304 * fold-const.c (operand_compare::hash_operand): Fix field hashing of CONSTRUCTOR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277768 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cdb5791b501d..418c3799f52b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-04 Martin Liska + + PR ipa/92304 + * fold-const.c (operand_compare::hash_operand): Fix field + hashing of CONSTRUCTOR. + 2019-11-04 Martin Liska * ggc.h (ggc_delete): New function. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fce503692fd8..1e25859a707b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3659,6 +3659,9 @@ operand_compare::hash_operand (const_tree t, inchash::hash &hstate, flags &= ~OEP_ADDRESS_OF; FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), idx, field, value) { + /* In GIMPLE the indexes can be either NULL or matching i. */ + if (field == NULL_TREE) + field = bitsize_int (idx); hash_operand (field, hstate, flags); hash_operand (value, hstate, flags); } -- 2.47.2