public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/66590] switch statement: incorrect warning "reaches end of non-void function"
Date: Wed, 25 Aug 2021 21:28:41 +0000	[thread overview]
Message-ID: <bug-66590-4-2RS4Vh9kAz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66590-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66590

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:971df602e0a798fe9c805c3105f4ac80d638a12b

commit r12-3145-g971df602e0a798fe9c805c3105f4ac80d638a12b
Author: Andrew Pinski <apinski@marvell.com>
Date:   Mon Aug 9 18:33:17 2021 -0700

    Fix PR c++/66590: incorrect warning "reaches end of non-void function" for
switch

    So the problem here is there is code in the C++ front-end not to add a
    break statement (to the IR) if the previous block does not fall through.
    The problem is the code which does the check to see if the block
    may fallthrough does not check a CLEANUP_STMT; it assumes it is always
    fall through.  Anyways this adds the code for the case of a CLEANUP_STMT
    that is only for !CLEANUP_EH_ONLY (the try/finally case).

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

    gcc/cp/ChangeLog:

            PR c++/66590
            * cp-objcp-common.c (cxx_block_may_fallthru): Handle
            CLEANUP_STMT for the case which will be try/finally.

    gcc/testsuite/ChangeLog:

            PR c++/66590
            * g++.dg/warn/Wreturn-5.C: New test.

  parent reply	other threads:[~2021-08-25 21:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 18:29 [Bug c++/66590] New: " brutus at free dot fr
2015-06-19  0:24 ` [Bug c++/66590] " pinskia at gcc dot gnu.org
2015-06-19  7:47 ` manu at gcc dot gnu.org
2015-09-23 18:06 ` miyuki at gcc dot gnu.org
2021-08-10  0:53 ` pinskia at gcc dot gnu.org
2021-08-10  1:00 ` pinskia at gcc dot gnu.org
2021-08-10  1:04 ` pinskia at gcc dot gnu.org
2021-08-10  1:31 ` pinskia at gcc dot gnu.org
2021-08-25 21:28 ` cvs-commit at gcc dot gnu.org [this message]
2021-08-25 21:29 ` pinskia 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-66590-4-2RS4Vh9kAz@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: link
Be 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).