aboutsummaryrefslogtreecommitdiff
path: root/libmudflap/mf-runtime.c
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2005-06-15 16:15:40 +0000
committerFrank Ch. Eigler <fche@gcc.gnu.org>2005-06-15 16:15:40 +0000
commite1f4adc93b6f663f481c1dc5a1ba7e6fb31c8af4 (patch)
tree50b5a1f27c89b4772df3a0f85aeb3dba758084d7 /libmudflap/mf-runtime.c
parent46bdb9cffb6b1cd45bc8032f9b1d7e9e101ba7b0 (diff)
downloadgcc-e1f4adc93b6f663f481c1dc5a1ba7e6fb31c8af4.zip
gcc-e1f4adc93b6f663f481c1dc5a1ba7e6fb31c8af4.tar.gz
gcc-e1f4adc93b6f663f481c1dc5a1ba7e6fb31c8af4.tar.bz2
Fix for uncaching bug reported by Herman ten Brugge.
2005-06-15 Frank Ch. Eigler <fche@redhat.com> Fix for uncaching bug reported by Herman ten Brugge. * mf-runtime.c (__mf_uncache_object): Search whole cache. * testsuite/libmudflap.c/fail40-frag.c: New test. From-SVN: r100985
Diffstat (limited to 'libmudflap/mf-runtime.c')
-rw-r--r--libmudflap/mf-runtime.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libmudflap/mf-runtime.c b/libmudflap/mf-runtime.c
index 5732c06..317aeae 100644
--- a/libmudflap/mf-runtime.c
+++ b/libmudflap/mf-runtime.c
@@ -919,7 +919,7 @@ void __mfu_check (void *ptr, size_t sz, int type, const char *location)
judgement = -1;
}
- /* We now know that the access spans one or more only valid objects. */
+ /* We now know that the access spans no invalid objects. */
if (LIKELY (judgement >= 0))
for (i = 0; i < obj_count; i++)
{
@@ -1064,14 +1064,14 @@ __mf_uncache_object (__mf_object_t *old_obj)
/* Can it possibly exist in the cache? */
if (LIKELY (old_obj->read_count + old_obj->write_count))
{
+ /* As reported by Herman ten Brugge, we need to scan the entire
+ cache for entries that may hit this object. */
uintptr_t low = old_obj->low;
uintptr_t high = old_obj->high;
- unsigned idx_low = __MF_CACHE_INDEX (low);
- unsigned idx_high = __MF_CACHE_INDEX (high);
+ struct __mf_cache *entry = & __mf_lookup_cache [0];
unsigned i;
- for (i = idx_low; i <= idx_high; i++)
+ for (i = 0; i <= __mf_lc_mask; i++, entry++)
{
- struct __mf_cache *entry = & __mf_lookup_cache [i];
/* NB: the "||" in the following test permits this code to
tolerate the situation introduced by __mf_check over
contiguous objects, where a cache entry spans several