diff options
author | Karl-Johan Karlsson <karl-johan.karlsson@ericsson.com> | 2023-08-31 09:34:26 +0200 |
---|---|---|
committer | Karl-Johan Karlsson <karl-johan.karlsson@ericsson.com> | 2023-08-31 10:08:15 +0200 |
commit | 831b509d5f73a4e8f86cf01de41c6e96f33de013 (patch) | |
tree | 4a0c5602b3d993aa6b17ff4bce6dec805aea1217 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | d7746220b10c7617cf2f53170af29e5c648c37db (diff) | |
download | llvm-831b509d5f73a4e8f86cf01de41c6e96f33de013.zip llvm-831b509d5f73a4e8f86cf01de41c6e96f33de013.tar.gz llvm-831b509d5f73a4e8f86cf01de41c6e96f33de013.tar.bz2 |
[builtins] Fix signed integer overflows in fp_fixint_impl.inc
When compiling the builtins with the undefined behavior sanitizer and running
testcases you end up with the following warning:
UBSan: fp_fixint_impl.inc:39:42: left shift of 8388608 by 40 places cannot be represented in type 'fixint_t' (aka 'long long')
UBSan: fp_fixint_impl.inc:39:17: signed integer overflow: -1 * -9223372036854775808 cannot be represented in type 'fixint_t' (aka 'long long')
This can be avoided by doing the shift and the multiplication in a matching
unsigned variant of the type.
The added test only trigger the intended signed overflow case when the builtins
are built with -D__SOFTFP__.
This was found in an out of tree target.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D159069
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions