aboutsummaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-01-23 12:43:26 +0100
committerRichard Biener <rguenther@suse.de>2020-01-23 12:46:39 +0100
commitf5ee5d05f367d6221b76f7a3ef7dad96605dbf04 (patch)
treef925dbaaeff662eeffb4dbf2e9223d46315269d1 /gcc/real.c
parent9592f639ff4655203f1cffb7c6752696e2721fb0 (diff)
downloadgcc-f5ee5d05f367d6221b76f7a3ef7dad96605dbf04.zip
gcc-f5ee5d05f367d6221b76f7a3ef7dad96605dbf04.tar.gz
gcc-f5ee5d05f367d6221b76f7a3ef7dad96605dbf04.tar.bz2
tree-optimization/93354 FRE redundant store removal validity fix
This fixes tracking of the alias-set of partial defs for use by redundant store removal. 2020-01-23 Richard Biener <rguenther@suse.de> PR tree-optimization/93381 * tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Take alias-set of the def as argument and record the first one. (vn_walk_cb_data::first_set): New member. (vn_reference_lookup_3): Pass the alias-set of the current def to push_partial_def. Fix alias-set used in the aggregate copy case. (vn_reference_lookup): Consistently set *last_vuse_ptr. * real.c (clear_significand_below): Fix out-of-bound access. * gcc.dg/torture/pr93354.c: New testcase.
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/real.c b/gcc/real.c
index a57e5df..46d8126 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -420,7 +420,10 @@ clear_significand_below (REAL_VALUE_TYPE *r, unsigned int n)
for (i = 0; i < w; ++i)
r->sig[i] = 0;
- r->sig[w] &= ~(((unsigned long)1 << (n % HOST_BITS_PER_LONG)) - 1);
+ /* We are actually passing N == SIGNIFICAND_BITS which would result
+ in an out-of-bound access below. */
+ if (n % HOST_BITS_PER_LONG != 0)
+ r->sig[w] &= ~(((unsigned long)1 << (n % HOST_BITS_PER_LONG)) - 1);
}
/* Divide the significands of A and B, placing the result in R. Return