public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51545] New: missing -Wparentheses diagnostic with compound assignment used as condition
@ 2011-12-14 1:17 manu at gcc dot gnu.org
2011-12-14 22:28 ` [Bug c++/51545] " marc.glisse at normalesup dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2011-12-14 1:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51545
Bug #: 51545
Summary: missing -Wparentheses diagnostic with compound
assignment used as condition
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: manu@gcc.gnu.org
Noticed here:
http://llvm.org/devmtg/2011-11/Weber_Wennborg_UsingClangInChromium.pdf
Testcase:
int foo(int x, int y)
{
if (x|=y) return 0;
return 1;
}
gcc 4.7 -Wall -Wextra -Wparentheses -Wlogical-op -Wtype-limits prints nothing.
clang 3.0 without extra flags:
test.cc:3:8: warning: using the result of an assignment as a condition without
parentheses [-Wparentheses]
if (x|=y) return 0;
~^~~
test.cc:3:8: note: place parentheses around the assignment to silence this
warning
if (x|=y) return 0;
^
( )
test.cc:3:8: note: use '!=' to turn this compound assignment into an inequality
comparison
if (x|=y) return 0;
^~
!=
1 warning generated.
Nonetheless, I still believe that using extra parentheses to silence these
warnings actually hides bugs and there are better alternatives. See PR25733.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/51545] missing -Wparentheses diagnostic with compound assignment used as condition
2011-12-14 1:17 [Bug c++/51545] New: missing -Wparentheses diagnostic with compound assignment used as condition manu at gcc dot gnu.org
@ 2011-12-14 22:28 ` marc.glisse at normalesup dot org
2011-12-15 12:22 ` mikpe at it dot uu.se
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: marc.glisse at normalesup dot org @ 2011-12-14 22:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51545
Marc Glisse <marc.glisse at normalesup dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marc.glisse at normalesup
| |dot org
--- Comment #1 from Marc Glisse <marc.glisse at normalesup dot org> 2011-12-14 22:27:15 UTC ---
PR 44949?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/51545] missing -Wparentheses diagnostic with compound assignment used as condition
2011-12-14 1:17 [Bug c++/51545] New: missing -Wparentheses diagnostic with compound assignment used as condition manu at gcc dot gnu.org
2011-12-14 22:28 ` [Bug c++/51545] " marc.glisse at normalesup dot org
@ 2011-12-15 12:22 ` mikpe at it dot uu.se
2021-08-13 7:12 ` egallager at gcc dot gnu.org
2021-08-13 14:50 ` msebor at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mikpe at it dot uu.se @ 2011-12-15 12:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51545
--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2011-12-15 12:09:21 UTC ---
Or perhaps PR50012? Parenthesized expressions get TREE_NO_WARNING set on them.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/51545] missing -Wparentheses diagnostic with compound assignment used as condition
2011-12-14 1:17 [Bug c++/51545] New: missing -Wparentheses diagnostic with compound assignment used as condition manu at gcc dot gnu.org
2011-12-14 22:28 ` [Bug c++/51545] " marc.glisse at normalesup dot org
2011-12-15 12:22 ` mikpe at it dot uu.se
@ 2021-08-13 7:12 ` egallager at gcc dot gnu.org
2021-08-13 14:50 ` msebor at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-08-13 7:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51545
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org,
| |msebor at gcc dot gnu.org
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Mikael Pettersson from comment #2)
> Or perhaps PR50012? Parenthesized expressions get TREE_NO_WARNING set on
> them.
I wonder if Martin Sebor's reworking of TREE_NO_WARNING has any effect here?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/51545] missing -Wparentheses diagnostic with compound assignment used as condition
2011-12-14 1:17 [Bug c++/51545] New: missing -Wparentheses diagnostic with compound assignment used as condition manu at gcc dot gnu.org
` (2 preceding siblings ...)
2021-08-13 7:12 ` egallager at gcc dot gnu.org
@ 2021-08-13 14:50 ` msebor at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-08-13 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51545
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |11.2.0, 12.0, 4.1.0
Last reconfirmed|2017-08-18 00:00:00 |2021-8-13
Version|unknown |4.0.0
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
No change in 12.0.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-13 14:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-14 1:17 [Bug c++/51545] New: missing -Wparentheses diagnostic with compound assignment used as condition manu at gcc dot gnu.org
2011-12-14 22:28 ` [Bug c++/51545] " marc.glisse at normalesup dot org
2011-12-15 12:22 ` mikpe at it dot uu.se
2021-08-13 7:12 ` egallager at gcc dot gnu.org
2021-08-13 14:50 ` msebor 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).