public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51894] New: Fail to warn on likely precedence error in conditional
@ 2012-01-18 20:00 aravindvijayan224185 at gmail dot com
2012-01-19 10:31 ` [Bug c/51894] " rguenth at gcc dot gnu.org
2012-01-19 13:59 ` manu at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: aravindvijayan224185 at gmail dot com @ 2012-01-18 20:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51894
Bug #: 51894
Summary: Fail to warn on likely precedence error in conditional
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: aravindvijayan224185@gmail.com
Created attachment 26371
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26371
example program showing the failure to warn
example program showing the failure to warn:
gcc version 4.7.0
If you have:
if (ret = return_neg_one() == 1)
printf("direct_test==true\n");
else
printf("direct_test==false\n");
The compiler will warn:
/tmp/tmp.c:51:2: warning: suggest parentheses around assignment used as truth
value
But if it is a complex conditional:
if (!cond ||
(ret = return_neg_one() == 1))
The compiler will not warn. It seems it should warn in this case as well.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/51894] Fail to warn on likely precedence error in conditional
2012-01-18 20:00 [Bug c/51894] New: Fail to warn on likely precedence error in conditional aravindvijayan224185 at gmail dot com
@ 2012-01-19 10:31 ` rguenth at gcc dot gnu.org
2012-01-19 13:59 ` manu at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-19 10:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51894
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-01-19
Ever Confirmed|0 |1
Severity|minor |enhancement
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 10:10:54 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/51894] Fail to warn on likely precedence error in conditional
2012-01-18 20:00 [Bug c/51894] New: Fail to warn on likely precedence error in conditional aravindvijayan224185 at gmail dot com
2012-01-19 10:31 ` [Bug c/51894] " rguenth at gcc dot gnu.org
@ 2012-01-19 13:59 ` manu at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2012-01-19 13:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51894
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |manu at gcc dot gnu.org
Resolution| |DUPLICATE
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-01-19 13:48:48 UTC ---
This is a more general issue with not warning for parenthesized expressions.
*** This bug has been marked as a duplicate of bug 25733 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-19 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-18 20:00 [Bug c/51894] New: Fail to warn on likely precedence error in conditional aravindvijayan224185 at gmail dot com
2012-01-19 10:31 ` [Bug c/51894] " rguenth at gcc dot gnu.org
2012-01-19 13:59 ` manu 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).