summaryrefslogtreecommitdiff
path: root/src/cpu/o3
diff options
context:
space:
mode:
authorSamuel Grayson <sam@samgrayson.me>2019-10-17 13:15:57 -0500
committerSamuel Grayson <sam@samgrayson.me>2019-10-31 03:37:54 +0000
commitdfd4c084f914539e605a1e34e7b3510dcd45f336 (patch)
treed7eb1964d07cb627bf90ca104992ca070bfd3bd3 /src/cpu/o3
parent5260c7efeff525b74f16258057abf83edb57c79e (diff)
downloadgem5-dfd4c084f914539e605a1e34e7b3510dcd45f336.tar.xz
ext: Fix undefined-behavior bug in bitshift
If a small number or zero is passed in, fp64_exp could be very negative (-1000 for example). The intent of the line is to evaluate to zero in these cases, but what it actually did was bitshift right by 1000, which is undefined behavior (according to ubsan) that so happens to result in 0 on GCC/most architectures. This commit changes the code to check for cases where the bitshift is larger than the width of the integer. Change-Id: I8de4bd8ad170f0321d54689460de449b7f8fb60a Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21859 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/cpu/o3')
0 files changed, 0 insertions, 0 deletions