public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ubsan: tc-nios2.c:1403 shift exponent 32 is too large
@ 2020-09-02  8:42 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2020-09-02  8:42 UTC (permalink / raw)
  To: binutils

	* config/tc-nios2.c (md_apply_fix): Avoid too large shift.

diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
index 0134b15ae0..5f0033a9f0 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;
 	      }
 	    }
-- 
Alan Modra
Australia Development Lab, IBM


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-02  8:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02  8:42 ubsan: tc-nios2.c:1403 shift exponent 32 is too large 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).