public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: -Werror,-Wtautological-overlap-compare error in h8300-tdep.c
Date: Sun, 17 May 2020 11:01:02 -0400	[thread overview]
Message-ID: <3caeb8ce-74d2-6409-3b9d-9bd2221d1cee@polymtl.ca> (raw)
In-Reply-To: <877dxaoeed.wl-ysato@users.sourceforge.jp>

On 2020-05-17 9:54 a.m., Yoshinori Sato wrote:
> On Sat, 16 May 2020 06:05:44 +0900,
> Simon Marchi wrote:
>>
>> When building with clang 11, we get:
>>
>>   CXX    h8300-tdep.o
>> /home/smarchi/src/binutils-gdb/gdb/h8300-tdep.c:225:21: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare]
>>               if (disp < 0 && disp > 0xffffff)
>>                   ~~~~~~~~~^~~~~~~~~~~~~~~~~~
>> /home/smarchi/src/binutils-gdb/gdb/h8300-tdep.c:203:17: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare]
>>           if (disp < 0 && disp > 0xffffff)
>>               ~~~~~~~~~^~~~~~~~~~~~~~~~~~
>> /home/smarchi/src/binutils-gdb/gdb/h8300-tdep.c:184:17: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare]
>>           if (disp < 0 && disp > 0xffffff)
>>               ~~~~~~~~~^~~~~~~~~~~~~~~~~~
>>
>> Indeed, disp (of type LONGEST) can't be less than 0 and greater than 0xffffff.
>>
>> The closest thing I could find to an instruction set reference was this:
>>
>>   https://www.renesas.com/cn/en/doc/products/mpumcu/001/e602025_h8300.pdf
>>
>> ... but it didn't really help me decode this code.  I'm reporting it in hope that
>> somebody that knows what they are doing would know how to fix it.
>>
>> Yoshinori, I CCed you because you happen to be the last person who did a meaningful commit
>> in h8300-tdep.c, so maybe you have an idea.
>>
>> Simon
> 
> This instruction enhanced on h8300h.
> https://www.renesas.com/us/en/doc/products/mpumcu/001/rej09b0213_h8300h.pdf
> 
> disp have 24bit value.
> So always 0 in upper byte.
> 
> I think it's good to check like this.

Thank you for providing the patch and providing the link to the relevant
documentation.

Could you please explain to me what this macro does?

#define IS_MOVB_EXT(x)		((x) == 0x7860)

If I understand correctly, the relevant encoding is described at page 125
of the document you linked.

It says that in the first byte, we should have 0x78 (we do).  In the second
byte, we should have `erd`, a register number, in the upper nibble.  The macro
above checks for a constant value, so does that mean it checks for a particulier
register number?

Simon

  reply	other threads:[~2020-05-17 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 21:05 Simon Marchi
2020-05-17 13:54 ` Yoshinori Sato
2020-05-17 15:01   ` Simon Marchi [this message]
2020-05-18 12:51     ` Yoshinori Sato
2020-05-19 17:35       ` Simon Marchi
2020-05-25  9:52         ` Yoshinori Sato

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=3caeb8ce-74d2-6409-3b9d-9bd2221d1cee@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=ysato@users.sourceforge.jp \
    /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).