public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: binutils@sourceware.org
Subject: Fix sanitization warning message building gas.
Date: Wed, 01 Feb 2023 09:48:28 +0000	[thread overview]
Message-ID: <87lelhzpg3.fsf@redhat.com> (raw)

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;


                 reply	other threads:[~2023-02-01  9:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lelhzpg3.fsf@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).