public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/60725] New: [-Wreturn-type] false positive in trivial switch
@ 2014-04-01  8:37 skvadrik at gmail dot com
  2014-04-01 13:52 ` [Bug middle-end/60725] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: skvadrik at gmail dot com @ 2014-04-01  8:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60725

            Bug ID: 60725
           Summary: [-Wreturn-type] false positive in trivial switch
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skvadrik at gmail dot com

Created attachment 32510
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32510&action=edit
wreturn_false_positive.c

Given this program (see attachment):

  // wreturn_false_positive.c
  enum E { E1 };
  static inline int f1(enum E e) {
      switch (e) {
          case E1: return 1;
      }
  }
  int main () {
      f1(E1);
      return 0;
  }

gcc generates warning:

$ gcc -Wall wreturn_false_positive.c 
wreturn_false_positive.c: In function ‘f1’:
wreturn_false_positive.c:9:1: warning: control reaches end of non-void function
[-Wreturn-type]

If I compile with '-fdump-tree-all', I see that gcc adds 'default' case to
switch very early (in .gimple), and later it cannot get rid of that 'default'
path. Why does gcc add default case?
>From gcc-bugs-return-448001-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 01 08:54:07 2014
Return-Path: <gcc-bugs-return-448001-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29764 invoked by alias); 1 Apr 2014 08:54:06 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29712 invoked by uid 48); 1 Apr 2014 08:54:02 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/60721] xcoral fails to build with LTO: internal compiler error: verify_flow_info failed
Date: Tue, 01 Apr 2014 08:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: lto
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth 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: <bug-60721-4-4TK0GbvaAS@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60721-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60721-4@http.gcc.gnu.org/bugzilla/>
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-04/txt/msg00021.txt.bz2
Content-length: 276

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`721

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
IMHO we need a flag on each gimple call whether that call instance is supposed
to be 'leaf' or not, similar to how we have noreturn and nothrow flags here.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-04 18:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-01  8:37 [Bug c/60725] New: [-Wreturn-type] false positive in trivial switch skvadrik at gmail dot com
2014-04-01 13:52 ` [Bug middle-end/60725] " mpolacek at gcc dot gnu.org
2015-09-04 15:26 ` jens.auer at cgi dot com
2015-09-04 17:41 ` manu at gcc dot gnu.org
2015-09-04 18:46 ` manu at gcc dot gnu.org

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).