From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129755 invoked by alias); 18 Jun 2015 01:05:47 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 129512 invoked by uid 48); 18 Jun 2015 01:05:42 -0000 From: "miyuki at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: miyuki at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-06/txt/msg01593.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572 --- Comment #3 from Mikhail Maltsev --- 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: unit size align 8 symtab 0 alias set -1 canonical type 0x7ffff6263888 precision 1 min max > 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.