public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108926] New: No warning for same expression in chain of | or & ?
@ 2023-02-24 14:21 dcb314 at hotmail dot com
  2023-02-24 14:22 ` [Bug c/108926] " dcb314 at hotmail dot com
  2023-02-27  8:38 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-24 14:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108926

            Bug ID: 108926
           Summary: No warning for same expression in chain of | or & ?
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Static analyser cppcheck has the ability to produce a style warning
for the same identifier used multiple times in the same expression.

Two examples are

linux-6.2/drivers/spi/spi-sn-f-ospi.c:614:31: style: Same expression
'SPI_TX_OCTAL' found multiple times in chain of '|' operators.
[duplicateExpression]

Source code is

    ctlr->mode_bits = SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL
        | SPI_RX_DUAL | SPI_RX_QUAD | SPI_TX_OCTAL
        | SPI_MODE_0 | SPI_MODE_1 | SPI_LSB_FIRST;

linux-6.2/tools/testing/selftests/powerpc/pmu/sampling_tests/mmcra_thresh_marked_sample_test.c:68:10:
style: Same expression '0x3' found multiple times in chain of '&' operators.
[duplicateExpression]

If gcc had this ability, then two kernel bugs would be found easily.
I will check binutils and glibc.

This bug is related to 53357.

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

* [Bug c/108926] No warning for same expression in chain of | or & ?
  2023-02-24 14:21 [Bug c/108926] New: No warning for same expression in chain of | or & ? dcb314 at hotmail dot com
@ 2023-02-24 14:22 ` dcb314 at hotmail dot com
  2023-02-27  8:38 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-24 14:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108926

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #0)
> This bug is related to 53357.

Sorry. 63357.

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

* [Bug c/108926] No warning for same expression in chain of | or & ?
  2023-02-24 14:21 [Bug c/108926] New: No warning for same expression in chain of | or & ? dcb314 at hotmail dot com
  2023-02-24 14:22 ` [Bug c/108926] " dcb314 at hotmail dot com
@ 2023-02-27  8:38 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-27  8:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108926

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement
   Last reconfirmed|                            |2023-02-27
           Keywords|                            |diagnostic
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=63357
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2023-02-27  8:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 14:21 [Bug c/108926] New: No warning for same expression in chain of | or & ? dcb314 at hotmail dot com
2023-02-24 14:22 ` [Bug c/108926] " dcb314 at hotmail dot com
2023-02-27  8:38 ` rguenth at gcc dot gnu.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).