]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gas/symbols.c
PR26448 UBSAN: symbols.c:1586 left shift of negative value
authorAlan Modra <amodra@gmail.com>
Wed, 26 Aug 2020 08:09:58 +0000 (17:39 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 26 Aug 2020 13:53:44 +0000 (23:23 +0930)
commitd8d6da137d7ececcd0e10c575aa187bb8c9b24e0
treef57f56b1a46cb23bcdbbbbd50cc3c914d0d4cfa9
parentb2f386b99caeab72eae26ca5bc9024421de145d9
PR26448 UBSAN: symbols.c:1586 left shift of negative value

Besides avoiding the UB, this also makes right shifts inside
expression symbols unsigned, consistent with the way gas evaluates
expressions in source.

PR 26448
* symbols.c: Include limits.h.
(resolve_symbol_value <O_left_shift, O_right_shift>): Do an
unsigned shift.  Warn if shift count larger than valueT size.
gas/ChangeLog
gas/symbols.c