[binutils-gdb] Silence asan warnings in resolve_symbol_value
Alan Modra
amodra@sourceware.org
Fri Jan 17 08:39:23 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1897dad5d755c0a0c0a9a3a294576add7d5c2280
commit 1897dad5d755c0a0c0a9a3a294576add7d5c2280
Author: Alan Modra <amodra@gmail.com>
Date: Fri Jan 17 17:57:48 2025 +1030
Silence asan warnings in resolve_symbol_value
The ".quad with division (fwdref)" gas test fails with asan warning
negation of -9223372036854775808 cannot be represented in type 'long int'
Fix this and another similar case.
* symbols.c (resolve_symbol_value): Cast "left" to valueT
before negating.
Diff:
---
gas/symbols.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gas/symbols.c b/gas/symbols.c
index 37a1e2b8215..14e6018b0cc 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -1596,7 +1596,7 @@ resolve_symbol_value (symbolS *symp)
final_seg = absolute_section;
if (op == O_uminus)
- left = -left;
+ left = -(valueT) left;
else if (op == O_logical_not)
left = !left;
else
@@ -1730,7 +1730,7 @@ resolve_symbol_value (symbolS *symp)
break;
if (right == -1)
{
- left = -left;
+ left = -(valueT) left;
break;
}
left /= right;
More information about the Binutils-cvs
mailing list