aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-31 15:51:24 +0930
committerAlan Modra <amodra@gmail.com>2020-08-31 20:28:11 +0930
commitbaeb994f3f6bf2b416676ad269f262675ab9d774 (patch)
treec6b285227bdb463947a32ad13ca25ff6716e98d9 /gas
parente0fd91ef813536b5ad4eef4e88412ac2a929997d (diff)
downloadgdb-baeb994f3f6bf2b416676ad269f262675ab9d774.zip
gdb-baeb994f3f6bf2b416676ad269f262675ab9d774.tar.gz
gdb-baeb994f3f6bf2b416676ad269f262675ab9d774.tar.bz2
PR26479 UBSAN: tc-nios2.c:244 left shift cannot be represented
PR 26479 * config/tc-nios2.c (md_chars_to_number): Cast buf[i] before shifting.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-nios2.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3d696a9..3f615cf 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
2020-08-31 Alan Modra <amodra@gmail.com>
+ PR 26479
+ * config/tc-nios2.c (md_chars_to_number): Cast buf[i] before shifting.
+
+2020-08-31 Alan Modra <amodra@gmail.com>
+
PR 26472
PR 26473
PR 26474
diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
index 467e2c9..16695c5 100644
--- a/gas/config/tc-nios2.c
+++ b/gas/config/tc-nios2.c
@@ -238,10 +238,10 @@ md_chars_to_number (char *buf, int n)
val = 0;
if (target_big_endian)
for (i = 0; i < n; ++i)
- val = val | ((buf[i] & 0xff) << 8 * (n - (i + 1)));
+ val = val | ((valueT) (buf[i] & 0xff) << 8 * (n - (i + 1)));
else
for (i = 0; i < n; ++i)
- val = val | ((buf[i] & 0xff) << 8 * i);
+ val = val | ((valueT) (buf[i] & 0xff) << 8 * i);
return val;
}