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;