public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/49409] New: some possible new warnings for strange code Date: Tue, 14 Jun 2011 19:15:00 -0000 [thread overview] Message-ID: <bug-49409-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49409 Summary: some possible new warnings for strange code Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: dcb314@hotmail.com Consider the following code extern void g( int); void f( int i) { if (i == i) // same thing compared g( i); if (i != i) // same thing compared g( 2 * i); if ((i - i) > 10) // X - X == 0, unless volatile g( 3 * i); if (i || i) // duplicates in || g( 4 * i); if (i && i) // duplicates in && g( 5 * i); } I ran the above code through the C++ compiler, with warning flags -Wall -Wextra and it was surprisingly silent. Would it be worthwhile for g++ to warn about some, all or none of the above coding errors ?
next reply other threads:[~2011-06-14 19:15 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-14 19:15 dcb314 at hotmail dot com [this message] 2011-06-14 22:34 ` [Bug c++/49409] " redi at gcc dot gnu.org 2011-06-15 10:03 ` rguenth at gcc dot gnu.org 2015-08-12 14:58 ` paolo.carlini at oracle dot com 2015-08-12 15:03 ` mpolacek at gcc dot gnu.org 2015-08-12 17:42 ` paolo.carlini at oracle dot com 2015-08-12 18:08 ` mpolacek at gcc dot gnu.org 2015-08-12 18:10 ` mpolacek at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-49409-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).