From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28131 invoked by alias); 22 Jul 2014 10:10:38 -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 27849 invoked by uid 48); 22 Jul 2014 10:10:27 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61867] gcc can't detect obviously false test Date: Tue, 22 Jul 2014 10:10: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: 4.9.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 2014-07/txt/msg01499.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61867 --- Comment #4 from Jonathan Wakely --- (In reply to David Binderman from comment #3) > I think that all that needs to happen is a warning is produced > where either the detection or reduction takes place. There is no single place, it's a result of constant propagation and a whole range of optimisations cooperating. Those optimisations are a good thing, you don't want to spit out a warning every time the compiler decides it can remove part of the code, you'd end up with either hundreds of warnings for correct code or disabling all optimisations. > As ever, users are free to ignore warnings. egrep -v is > useful, I find. egrep is useless for ignoring warnings. It might help on the command line, but not if you run the compiler from an editor or IDE, or with -Werror etc. Just because you don't mind ignoring warnings doesn't mean it is appropriate for GCC to start spitting out poor quality warnings.