aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-lang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-30 19:37:57 +0930
committerAlan Modra <amodra@gmail.com>2020-08-30 20:49:18 +0930
commitc930281005b0a01ab824864c231c19c297bfdda5 (patch)
tree100a7c5da77337a593a8dc18387219ecddf7a179 /gdb/f-lang.c
parent34d8e6d0c5f3c51d0e7858572791d8269b9d0f1c (diff)
downloadgdb-c930281005b0a01ab824864c231c19c297bfdda5.zip
gdb-c930281005b0a01ab824864c231c19c297bfdda5.tar.gz
gdb-c930281005b0a01ab824864c231c19c297bfdda5.tar.bz2
PR26437, PR26438 UBSAN: tc-cr16.c left shifts and overflows
Always use unsigned constants in expressions generating masks. The following trys mightily to avoid UB (but hits it anyway with bits=32 and 0x7fffffff << 1), and worse, for 32-bit int, 64-bit long, bits=32 doesn't generate 0xffffffff. max = ((((1 << (bits - 1)) - 1) << 1) | 1); results in -1, or max = 0xffffffffffffffff. This patch fixes that problem, a possible shift exponent of -1U, removes some dead code, and makes general tidies. PR26437 PR26438 * config/tc-cr16.c: Include limits.h, formatting. (CR16_PRINT): Wrap params in parentheses. Remove parens from uses throughout file. (getconstant): Handle zero nbits. (print_operand): Simplify handling of index regs. (check_range): Use int32_t variables. Correct range checks.
Diffstat (limited to 'gdb/f-lang.c')
0 files changed, 0 insertions, 0 deletions