]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Silence asan warnings in resolve_symbol_value
authorAlan Modra <amodra@gmail.com>
Fri, 17 Jan 2025 07:27:48 +0000 (17:57 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 17 Jan 2025 08:36:39 +0000 (19:06 +1030)
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.

gas/symbols.c

index 37a1e2b82153c7dd397b1c283094ba21bfd0b533..14e6018b0cc5a60dffbae8ac82e2f089e4a3a3f5 100644 (file)
@@ -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;