This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] gas: microblaze: fix shift overflow
- From: Mike Frysinger <vapier at gentoo dot org>
- To: binutils at sourceware dot org
- Date: Sun, 15 Nov 2015 02:49:03 -0500
- Subject: [PATCH] gas: microblaze: fix shift overflow
- Authentication-results: sourceware.org; auth=none
This code tries to shift an integer 31 bits which triggers a werror:
gas/config/tc-microblaze.c:742:21: error: integer overflow in expression [-Werror=overflow]
e->X_add_number |= -(1 << 31);
Cast the 1 to offsetT to match X_add_number to fix things.
2015-11-15 Mike Frysinger <vapier@gentoo.org>
* config/tc-microblaze.c (parse_imm): Add an offsetT cast.
---
gas/config/tc-microblaze.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index ac7c828..0ec24f8 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -739,7 +739,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
{
/* Special case: sign extend negative 32-bit values to 64-bits. */
if ((e->X_add_number >> 31) == 1)
- e->X_add_number |= -(1 << 31);
+ e->X_add_number |= -((offsetT) 1 << 31);
if (e->X_add_number < min || e->X_add_number > max)
{
--
2.6.2