diff options
author | florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2015-02-06 20:32:15 +0000 |
---|---|---|
committer | florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2015-02-06 20:32:15 +0000 |
commit | 45ee036d5512d088f138c143e8be8c1002e452e4 (patch) | |
tree | 310dbd7ce71aba428e5963e27e6fdea864e6f13c /callgrind | |
parent | 5381b429d97ffee625fc6d0f202c21b7bde4d64d (diff) | |
download | valgrind-45ee036d5512d088f138c143e8be8c1002e452e4.tar.gz |
Fix undefined behaviours when shifting.
Found by libubsan.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14913 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'callgrind')
-rw-r--r-- | callgrind/sim.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/callgrind/sim.c b/callgrind/sim.c index fe1e81e5b..7478a32ed 100644 --- a/callgrind/sim.c +++ b/callgrind/sim.c @@ -183,8 +183,8 @@ static void cachesim_initcache(cache_t config, cache_t2* c) c->sets = (c->size / c->line_size) / c->assoc; c->sets_min_1 = c->sets - 1; c->line_size_bits = VG_(log2)(c->line_size); - c->tag_shift = c->line_size_bits + VG_(log2)(c->sets); - c->tag_mask = ~((1<<c->tag_shift)-1); + c->tag_shift = c->line_size_bits + VG_(log2)(c->sets); + c->tag_mask = ~((1u<<c->tag_shift)-1); /* Can bits in tag entries be used for flags? * Should be always true as MIN_LINE_SIZE >= 16 */ @@ -650,7 +650,7 @@ void cacheuse_initcache(cache_t2* c) else { int bytes_per_bit = c->line_size/32; start_mask = 1; - end_mask = 1 << 31; + end_mask = 1u << 31; for(i=0;i<c->line_size;i++) { c->line_start_mask[i] = start_val; c->line_end_mask[c->line_size-i-1] = end_val; |