public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "miyuki at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/66572] [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations Date: Thu, 18 Jun 2015 01:05:00 -0000 [thread overview] Message-ID: <bug-66572-4-OKqTMfN6TB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-66572-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572 --- Comment #3 from Mikhail Maltsev <miyuki at gcc dot gnu.org> --- Started with r222408. The commit message says: PR c/63357 * c-common.c (warn_logical_operator): Warn if the operands have the same expressions. * doc/invoke.texi: Update description of -Wlogical-op. Apperntly, the warning about same expressions in a logical expression was added to Wlogical-op after GCC 5.1 release (I didn't know that) and it had this problem from the very beginning. In warn_logical_operator we have a check: /* We do not warn for constants because they are typical of macro expansions that test for features. */ if (CONSTANT_CLASS_P (op_left) || CONSTANT_CLASS_P (op_right)) return; But in this case op_left and op_right are: <var_decl 0x7ffff6118bd0 value type <boolean_type 0x7ffff6263888 bool readonly public unsigned QI size <integer_cst 0x7ffff610bf48 constant 8> unit size <integer_cst 0x7ffff610bf60 constant 1> align 8 symtab 0 alias set -1 canonical type 0x7ffff6263888 precision 1 min <integer_cst 0x7ffff612e1b0 0> max <integer_cst 0x7ffff612e1e0 1>> I think it's still possible to fix this check to handle C++ boolean constants properly (as if they were literal constants). But for general case we probably must somehow know (e.g. add a new flag to enum tsubst_flags and pass it to warn_logical_operator from build_new_op_1), that current expression depends on template parameter.
next prev parent reply other threads:[~2015-06-18 1:05 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-17 14:45 [Bug c++/66572] New: " miyuki at gcc dot gnu.org 2015-06-17 16:47 ` [Bug c++/66572] " manu at gcc dot gnu.org 2015-06-17 18:00 ` miyuki at gcc dot gnu.org 2015-06-18 1:05 ` miyuki at gcc dot gnu.org [this message] 2015-07-23 18:58 ` mpolacek at gcc dot gnu.org 2015-07-23 18:59 ` 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-66572-4-OKqTMfN6TB@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).