aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-02 10:22:39 +0930
committerAlan Modra <amodra@gmail.com>2020-09-02 16:30:43 +0930
commit1929210d46cdf331fce175f0c4124777c0b12d18 (patch)
tree08491aff8061bd753fa53d8afe662d63265afcae
parent7697028a6cff4ba5465c0b3256697df48bd2c60e (diff)
downloadgdb-1929210d46cdf331fce175f0c4124777c0b12d18.zip
gdb-1929210d46cdf331fce175f0c4124777c0b12d18.tar.gz
gdb-1929210d46cdf331fce175f0c4124777c0b12d18.tar.bz2
ubsan: tc-nios2.c:1403 shift exponent 32 is too large
* config/tc-nios2.c (md_apply_fix): Avoid too large shift.
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-nios2.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index fece8b5..b6bc209 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,9 @@
2020-09-02 Alan Modra <amodra@gmail.com>
+ * config/tc-nios2.c (md_apply_fix): Avoid too large shift.
+
+2020-09-02 Alan Modra <amodra@gmail.com>
+
* config/tc-mips.c (load_register): Avoid too large shift.
2020-09-02 Alan Modra <amodra@gmail.com>
diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
index 0134b15..5f0033a 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;
}
}