From 58a345fe1f0407cb2743da0b295ef28cc7f23c72 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 15 Nov 2015 02:46:03 -0500 Subject: [PATCH] gas: microblaze: fix shift overflow 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. --- gas/ChangeLog | 4 ++++ gas/config/tc-microblaze.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 955fd2ec643..41e44b5438e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2015-11-16 Mike Frysinger + + * config/tc-microblaze.c (parse_imm): Add an offsetT cast. + 2015-11-13 Tristan Gingold * configure: Regenerate. diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index ac7c828ccec..0ec24f88217 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.30.2