public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108753] New: '-Wduplicated-cond' doesn't diagnose duplicated subexpressions
@ 2023-02-10 13:51 tschwinge at gcc dot gnu.org
  2023-02-10 14:58 ` [Bug c/108753] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-02-10 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108753
           Summary: '-Wduplicated-cond' doesn't diagnose duplicated
                    subexpressions
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Created attachment 54448
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54448&action=edit
pr.c

Shouldn't '-Wduplicated-cond' be able to diagnose the XFAILed duplicated
subexpressions?  (In the attached 'pr.c', 'f2' is reduced from real-world
code.)

This works:

    if (a == 5) // { dg-note {previously used here} }
      return 30;
    else if (a == 5) // { dg-warning {duplicated 'if' condition} }
      return 40;

..., but this and similar ones don't:

    if (a == 5) // { dg-note {previously used here} TODO { xfail *-*-* } }
      return 30;
    else if (a == 5 // { dg-warning {duplicated 'if' condition} TODO { xfail
*-*-* } }
             || a == 6)
      return 40;

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

* [Bug c/108753] '-Wduplicated-cond' doesn't diagnose duplicated subexpressions
  2023-02-10 13:51 [Bug c/108753] New: '-Wduplicated-cond' doesn't diagnose duplicated subexpressions tschwinge at gcc dot gnu.org
@ 2023-02-10 14:58 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-02-10 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement
   Last reconfirmed|                            |2023-02-10

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
It probably could.

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

end of thread, other threads:[~2023-02-10 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 13:51 [Bug c/108753] New: '-Wduplicated-cond' doesn't diagnose duplicated subexpressions tschwinge at gcc dot gnu.org
2023-02-10 14:58 ` [Bug c/108753] " mpolacek 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).