public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR26509 UBSAN: tc-z80.c:3656 shift exponent is too large
@ 2020-09-01  6:49 Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2020-09-01  6:49 UTC (permalink / raw)
  To: binutils

	PR 26509
	* config/tc-z80.c (is_overflow): Use 1UL in mask shift expression.

diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 237425da35..45fcd6fbf7 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -3653,7 +3653,7 @@ md_assemble (char *str)
 static int
 is_overflow (long value, unsigned bitsize)
 {
-  long fieldmask = (1 << bitsize) - 1;
+  long fieldmask = (1UL << bitsize) - 1;
   long signmask = ~fieldmask;
   long a = value & fieldmask;
   long ss = a & signmask;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

* PR26509 UBSAN: tc-z80.c:3656 shift exponent is too large
@ 2020-08-31 10:50 Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2020-08-31 10:50 UTC (permalink / raw)
  To: binutils

	PR 26509
	* config/tc-z80.c (is_overflow): Use 1UL in mask shift expression.

diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 237425da35..45fcd6fbf7 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -3653,7 +3653,7 @@ md_assemble (char *str)
 static int
 is_overflow (long value, unsigned bitsize)
 {
-  long fieldmask = (1 << bitsize) - 1;
+  long fieldmask = (1UL << bitsize) - 1;
   long signmask = ~fieldmask;
   long a = value & fieldmask;
   long ss = a & signmask;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-01  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01  6:49 PR26509 UBSAN: tc-z80.c:3656 shift exponent is too large Alan Modra
  -- strict thread matches above, loose matches on Subject: below --
2020-08-31 10:50 Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).