From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22729 invoked by alias); 20 May 2015 13:19:14 -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 22118 invoked by uid 48); 20 May 2015 13:19:07 -0000 From: "sirl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/66220] New: -Wmisleading-indentation false/inconsistent warning Date: Wed, 20 May 2015 13:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sirl at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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-05/txt/msg01645.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66220 Bug ID: 66220 Summary: -Wmisleading-indentation false/inconsistent warning Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sirl at gcc dot gnu.org Target Milestone: --- Created attachment 35578 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35578&action=edit Testcase to reproduce The following indenting style generates a false warning: int test1(int v) { int res = 28; if (v == 2) { res = 27; } else { res = 18; } return res; } test-indent.c: In function 'test1': test-indent.c:13:5: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation] return res; ^ test-indent.c:9:7: note: ...this 'else' clause, but it is not } else ^ Even though I don't like this style, I don't think it's misleading. If you change the 'else' to 'else if ()' the warning goes away, that's why think it's at least inconsistent.