From: Alan Modra Date: Wed, 2 Sep 2020 00:59:21 +0000 (+0930) Subject: ubsan: expr.c:1725,1741 signed integer overflow X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c77a6ef6109c10e999b33e8f762809701084109c;p=binutils-gdb.git ubsan: expr.c:1725,1741 signed integer overflow * expr.c (add_to_result, subtract_from_result): Use unsigned addition and subtraction. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 641b68de66a..004834f68c9 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2020-09-02 Alan Modra + + * expr.c (add_to_result, subtract_from_result): Use unsigned + addition and subtraction. + 2020-09-02 Alan Modra * config/tc-z80.c (is_overflow): Avoid too large shift. diff --git a/gas/expr.c b/gas/expr.c index da4fbcf8cd6..6f74de786d2 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -1722,7 +1722,7 @@ add_to_result (expressionS *resultP, offsetT amount, int rhs_highbit) valueT ures = resultP->X_add_number; valueT uamount = amount; - resultP->X_add_number += amount; + resultP->X_add_number += uamount; resultP->X_extrabit ^= rhs_highbit; @@ -1738,7 +1738,7 @@ subtract_from_result (expressionS *resultP, offsetT amount, int rhs_highbit) valueT ures = resultP->X_add_number; valueT uamount = amount; - resultP->X_add_number -= amount; + resultP->X_add_number -= uamount; resultP->X_extrabit ^= rhs_highbit;