public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Fix sanitization warning message building gas.
@ 2023-02-01  9:48 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-02-01  9:48 UTC (permalink / raw)
  To: binutils

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

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-01  9:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01  9:48 Fix sanitization warning message building gas Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).