aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-11-27 14:30:36 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-11-27 14:30:36 +0000
commit53d2b7cb8623bde9ad120e97cca1b36938cfb9e7 (patch)
treea43c8ca21970c96673fbf9fd6f2dc0c93091d872 /gcc/tree.c
parentd7dccfa38d6853680dbd40117e2cd4fc94ba9206 (diff)
downloadgcc-53d2b7cb8623bde9ad120e97cca1b36938cfb9e7.zip
gcc-53d2b7cb8623bde9ad120e97cca1b36938cfb9e7.tar.gz
gcc-53d2b7cb8623bde9ad120e97cca1b36938cfb9e7.tar.bz2
tree.c (wide_int_to_tree): Free discarded INTEGER_CST.
2017-11-27 Richard Biener <rguenther@suse.de> * tree.c (wide_int_to_tree): Free discarded INTEGER_CST. (type_hash_canon): Also clear int_cst_hash_table entry for TYPE_MIN/MAX_VALUE. (build_nonstandard_integer_type): Hash all TYPE_MAX_VALUEs. From-SVN: r255171
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 7efd644..c328b13 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1576,6 +1576,8 @@ wide_int_to_tree (tree type, const wide_int_ref &pcst)
t = nt;
*slot = t;
}
+ else
+ ggc_free (nt);
}
return t;
@@ -6496,10 +6498,18 @@ type_hash_canon (unsigned int hashcode, tree type)
{
if (TYPE_MIN_VALUE (type)
&& TREE_TYPE (TYPE_MIN_VALUE (type)) == type)
- ggc_free (TYPE_MIN_VALUE (type));
+ {
+ /* Zero is always in TYPE_CACHED_VALUES. */
+ if (! TYPE_UNSIGNED (type))
+ int_cst_hash_table->remove_elt (TYPE_MIN_VALUE (type));
+ ggc_free (TYPE_MIN_VALUE (type));
+ }
if (TYPE_MAX_VALUE (type)
&& TREE_TYPE (TYPE_MAX_VALUE (type)) == type)
- ggc_free (TYPE_MAX_VALUE (type));
+ {
+ int_cst_hash_table->remove_elt (TYPE_MAX_VALUE (type));
+ ggc_free (TYPE_MAX_VALUE (type));
+ }
if (TYPE_CACHED_VALUES_P (type))
ggc_free (TYPE_CACHED_VALUES (type));
}
@@ -7486,8 +7496,10 @@ build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision,
fixup_signed_type (itype);
ret = itype;
- if (tree_fits_uhwi_p (TYPE_MAX_VALUE (itype)))
- ret = type_hash_canon (tree_to_uhwi (TYPE_MAX_VALUE (itype)), itype);
+
+ inchash::hash hstate;
+ inchash::add_expr (TYPE_MAX_VALUE (itype), hstate);
+ ret = type_hash_canon (hstate.end (), itype);
if (precision <= MAX_INT_CACHED_PREC)
nonstandard_integer_type_cache[precision + unsignedp] = ret;