From 1929210d46cdf331fce175f0c4124777c0b12d18 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 2 Sep 2020 10:22:39 +0930 Subject: [PATCH] ubsan: tc-nios2.c:1403 shift exponent 32 is too large * config/tc-nios2.c (md_apply_fix): Avoid too large shift. --- gas/ChangeLog | 4 ++++ gas/config/tc-nios2.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index fece8b59412..b6bc2099cd7 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2020-09-02 Alan Modra + + * config/tc-nios2.c (md_apply_fix): Avoid too large shift. + 2020-09-02 Alan Modra * config/tc-mips.c (load_register): Avoid too large shift. diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c index 0134b15ae08..5f0033a9f0c 100644 --- a/gas/config/tc-nios2.c +++ b/gas/config/tc-nios2.c @@ -1400,7 +1400,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) break; default: { - fixup &= ((valueT) 1 << howto->bitsize) - 1; + fixup &= ((valueT) 2 << (howto->bitsize - 1)) - 1; break; } } -- 2.30.2