aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-11-04 10:11:26 +0100
committerMartin Liska <marxin@gcc.gnu.org>2019-11-04 09:11:26 +0000
commit2323aa040bb4b401445d27bfe6f8c75a50ecf76d (patch)
tree4ff5ad4007f12854d4293c3379997263400ab372
parentddf628e42fe261293cbbe39d0d8b38d30d852154 (diff)
downloadgcc-2323aa040bb4b401445d27bfe6f8c75a50ecf76d.zip
gcc-2323aa040bb4b401445d27bfe6f8c75a50ecf76d.tar.gz
gcc-2323aa040bb4b401445d27bfe6f8c75a50ecf76d.tar.bz2
Fix hash_operand for fields of a CONSTRUCTOR.
2019-11-04 Martin Liska <mliska@suse.cz> PR ipa/92304 * fold-const.c (operand_compare::hash_operand): Fix field hashing of CONSTRUCTOR. From-SVN: r277768
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/fold-const.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cdb5791..418c379 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2019-11-04 Martin Liska <mliska@suse.cz>
+ PR ipa/92304
+ * fold-const.c (operand_compare::hash_operand): Fix field
+ hashing of CONSTRUCTOR.
+
+2019-11-04 Martin Liska <mliska@suse.cz>
+
* ggc.h (ggc_delete): New function.
* ipa-fnsummary.c (ipa_free_fn_summary): Use it.
* ipa-prop.c (ipa_free_all_edge_args): Likewise.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index fce5036..1e25859 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);
}