aboutsummaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-02 10:29:21 +0930
committerAlan Modra <amodra@gmail.com>2020-09-02 16:30:43 +0930
commitc77a6ef6109c10e999b33e8f762809701084109c (patch)
treec38e0192b831a6dc32dd6c2c10f8d1b186d6123d /gas/expr.c
parent01a6f9da644e52fbd644a8e8f58d58c0383118c8 (diff)
downloadgdb-c77a6ef6109c10e999b33e8f762809701084109c.zip
gdb-c77a6ef6109c10e999b33e8f762809701084109c.tar.gz
gdb-c77a6ef6109c10e999b33e8f762809701084109c.tar.bz2
ubsan: expr.c:1725,1741 signed integer overflow
* expr.c (add_to_result, subtract_from_result): Use unsigned addition and subtraction.
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gas/expr.c b/gas/expr.c
index da4fbcf..6f74de7 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;