Fix sanitization warning message building gas.

Message ID 87lelhzpg3.fsf@redhat.com
State Repeat Merge
Headers
Series Fix sanitization warning message building gas. |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Nick Clifton Feb. 1, 2023, 9:48 a.m. UTC
  Hi Guys,

  I am applying the patch below to fix a couple of compile time warnings
  when building the assembler with sanitization enabled:

gas/dwarf2dbg.c: In function 'size_inc_line_addr':
gas/dwarf2dbg.c:1644:18: error: comparison of integer expressions of different signedness: 'addressT' {aka 'long unsigned int'} and 'int' [-Werror=sign-compare]
 1644 |   if (addr_delta < 256 + MAX_SPECIAL_ADDR_DELTA)

gas/dwarf2dbg.c: In function 'emit_inc_line_addr':
gas/dwarf2dbg.c:1726:18: error: comparison of integer expressions of different signedness: 'addressT' {aka 'long unsigned int'} and 'int' [-Werror=sign-compare]
 1726 |   if (addr_delta < 256 + MAX_SPECIAL_ADDR_DELTA)

Cheers
  Nick
  

Patch

diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index b54050c6442..05f966256e4 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1641,7 +1641,7 @@  size_inc_line_addr (int line_delta, addressT addr_delta)
   tmp += DWARF2_LINE_OPCODE_BASE;
 
   /* Avoid overflow when addr_delta is large.  */
-  if (addr_delta < 256 + MAX_SPECIAL_ADDR_DELTA)
+  if (addr_delta < 256U + MAX_SPECIAL_ADDR_DELTA)
     {
       /* Try using a special opcode.  */
       opcode = tmp + addr_delta * DWARF2_LINE_RANGE;
@@ -1723,7 +1723,7 @@  emit_inc_line_addr (int line_delta, addressT addr_delta, char *p, int len)
   tmp += DWARF2_LINE_OPCODE_BASE;
 
   /* Avoid overflow when addr_delta is large.  */
-  if (addr_delta < 256 + MAX_SPECIAL_ADDR_DELTA)
+  if (addr_delta < 256U + MAX_SPECIAL_ADDR_DELTA)
     {
       /* Try using a special opcode.  */
       opcode = tmp + addr_delta * DWARF2_LINE_RANGE;