public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c
@ 2020-05-15 21:08 simark at simark dot ca
  2020-05-15 21:08 ` [Bug tdep/26000] " simark at simark dot ca
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: simark at simark dot ca @ 2020-05-15 21:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

            Bug ID: 26000
           Summary: -Wtautological-bitwise-compare error in arm-tdep.c
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

We get this error in arm-tdep.c when building with clang 11:

  CXX    arm-tdep.o
/home/smarchi/src/binutils-gdb/gdb/arm-tdep.c:934:29: error: bitwise comparison
always evaluates to false [-Werror,-Wtautological-bitwise-compare]
          else if ((insn & 0xffb0) == 0xe950    /* ldrd Rt, Rt2,
                   ~~~~~~~~~~~~~~~~^~~~~~~~~

Indeed, this can never evaluate to true.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
@ 2020-05-15 21:08 ` simark at simark dot ca
  2020-05-15 22:41 ` luis.machado at linaro dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: simark at simark dot ca @ 2020-05-15 21:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |luis.machado at linaro dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
  2020-05-15 21:08 ` [Bug tdep/26000] " simark at simark dot ca
@ 2020-05-15 22:41 ` luis.machado at linaro dot org
  2020-05-15 22:45 ` simark at simark dot ca
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: luis.machado at linaro dot org @ 2020-05-15 22:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

Luis Machado <luis.machado at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #1 from Luis Machado <luis.machado at linaro dot org> ---
As was discussed on IRC, Simon hinted at problems handling these ldrd/strd's.

Even when fixing the pattern to match ldrd (immediate), with mask 0xff50, the
mask isn't strict enough to match *only* ldrd (immediate). It will also match
ldrd (literal). So we need to verify op1 != 1111 to rule out ldrd (literal).

Then there is the question of whether we want to handle all variants of
ldrd/strd's, which may or may not be important to fix.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
  2020-05-15 21:08 ` [Bug tdep/26000] " simark at simark dot ca
  2020-05-15 22:41 ` luis.machado at linaro dot org
@ 2020-05-15 22:45 ` simark at simark dot ca
  2020-05-16  2:49 ` luis.machado at linaro dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: simark at simark dot ca @ 2020-05-15 22:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

--- Comment #2 from Simon Marchi <simark at simark dot ca> ---
(In reply to Luis Machado from comment #1)
> As was discussed on IRC, Simon hinted at problems handling these ldrd/strd's.
> 
> Even when fixing the pattern to match ldrd (immediate), with mask 0xff50,
> the mask isn't strict enough to match *only* ldrd (immediate). It will also
> match ldrd (literal). So we need to verify op1 != 1111 to rule out ldrd
> (literal).
> 
> Then there is the question of whether we want to handle all variants of
> ldrd/strd's, which may or may not be important to fix.

To clarify, could you show here what's the full condition you would use with
mask 0xff50?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
                   ` (2 preceding siblings ...)
  2020-05-15 22:45 ` simark at simark dot ca
@ 2020-05-16  2:49 ` luis.machado at linaro dot org
  2020-05-16  2:49 ` luis.machado at linaro dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: luis.machado at linaro dot org @ 2020-05-16  2:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

--- Comment #3 from Luis Machado <luis.machado at linaro dot org> ---
Created attachment 12548
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12548&action=edit
Tentative patch

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
                   ` (3 preceding siblings ...)
  2020-05-16  2:49 ` luis.machado at linaro dot org
@ 2020-05-16  2:49 ` luis.machado at linaro dot org
  2020-05-16  2:53 ` luis.machado at linaro dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: luis.machado at linaro dot org @ 2020-05-16  2:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

--- Comment #4 from Luis Machado <luis.machado at linaro dot org> ---
This is what i plan to submit as a fix, after i'm done with testing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
                   ` (4 preceding siblings ...)
  2020-05-16  2:49 ` luis.machado at linaro dot org
@ 2020-05-16  2:53 ` luis.machado at linaro dot org
  2020-05-27 12:43 ` cvs-commit at gcc dot gnu.org
  2020-05-27 12:44 ` luis.machado at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: luis.machado at linaro dot org @ 2020-05-16  2:53 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

Luis Machado <luis.machado at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #12548|0                           |1
        is obsolete|                            |

--- Comment #5 from Luis Machado <luis.machado at linaro dot org> ---
Created attachment 12549
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12549&action=edit
Tentative patch

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
                   ` (5 preceding siblings ...)
  2020-05-16  2:53 ` luis.machado at linaro dot org
@ 2020-05-27 12:43 ` cvs-commit at gcc dot gnu.org
  2020-05-27 12:44 ` luis.machado at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-27 12:43 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Luis Machado <luisgpm@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f8c6d1528c19b11fdaa3ec949147280e500446e2

commit f8c6d1528c19b11fdaa3ec949147280e500446e2
Author: Luis Machado <luis.machado@linaro.org>
Date:   Fri May 15 23:06:52 2020 -0300

    Fix PR 26000, logical bitwise error / prologue analyzer

    This fixes an instruction mask typo. We should be matching only
    ldrd (immediate) and not any other of its variants. As is, it never matches
    anything.

    With the patch, the instruction mask also allows matching of ldrd
(literal),
    but the check for SP discards this particular instruction pattern, as it
has
    a hardcoded PC register.

    gdb/ChangeLog:

    2020-05-27  Luis Machado  <luis.machado@linaro.org>

            PR tdep/26000
            * arm-tdep.c (thumb_analyze_prologue): Fix instruction matching
            for ldrd (immediate).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tdep/26000] -Wtautological-bitwise-compare error in arm-tdep.c
  2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
                   ` (6 preceding siblings ...)
  2020-05-27 12:43 ` cvs-commit at gcc dot gnu.org
@ 2020-05-27 12:44 ` luis.machado at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: luis.machado at linaro dot org @ 2020-05-27 12:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26000

Luis Machado <luis.machado at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Luis Machado <luis.machado at linaro dot org> ---
Fixed with the last patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-05-27 12:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 21:08 [Bug tdep/26000] New: -Wtautological-bitwise-compare error in arm-tdep.c simark at simark dot ca
2020-05-15 21:08 ` [Bug tdep/26000] " simark at simark dot ca
2020-05-15 22:41 ` luis.machado at linaro dot org
2020-05-15 22:45 ` simark at simark dot ca
2020-05-16  2:49 ` luis.machado at linaro dot org
2020-05-16  2:49 ` luis.machado at linaro dot org
2020-05-16  2:53 ` luis.machado at linaro dot org
2020-05-27 12:43 ` cvs-commit at gcc dot gnu.org
2020-05-27 12:44 ` luis.machado at linaro dot org

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).