From: Jeff Law <law@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>,
"Joseph S. Myers" <joseph@codesourcery.com>,
Marek Polacek <polacek@redhat.com>,
Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [C PATCH] Handle C SWITCH_EXPR in block_may_fallthru (PR sanitizer/81275)
Date: Tue, 28 Nov 2017 17:43:00 -0000 [thread overview]
Message-ID: <0a4d5461-2b49-6d1b-645a-8861554e64ad@redhat.com> (raw)
In-Reply-To: <20171128084928.GO2353@tucnak>
On 11/28/2017 01:49 AM, Jakub Jelinek wrote:
> Hi!
>
> This is the C version of the switch block_may_fallthru handling.
> Unlike C++ SWITCH_STMT, break; is represented in SWITCH_EXPR by a goto
> to a label emitted after the SWITCH_EXPR, so either block_may_fallthru
> finds such label (but then doesn't find the SWITCH_EXPR), or it
> finds SWITCH_EXPR, in which case if the body doesn't fall through (e.g.
> ends with a return stmt), then it may fall through only if it doesn't
> cover all the cases.
>
> This patch adds a bit that signals that, and computes whether all cases
> are covered (either if default: is present, or by walking the splay tree).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2017-11-28 Jakub Jelinek <jakub@redhat.com>
>
> PR sanitizer/81275
> * tree.c (block_may_fallthru): Return false if SWITCH_ALL_CASES_P
> is set on SWITCH_EXPR and !block_may_fallthru (SWITCH_BODY ()).
> c/
> * c-typeck.c (c_finish_case): Set SWITCH_ALL_CASES_P if
> c_switch_covers_all_cases_p returns true.
> c-family/
> * c-common.c (c_switch_covers_all_cases_p_1,
> c_switch_covers_all_cases_p): New functions.
> * c-common.h (c_switch_covers_all_cases_p): Declare.
> testsuite/
> * c-c++-common/tsan/pr81275.c: New test.
OK.
jeff
prev parent reply other threads:[~2017-11-28 17:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 9:12 Jakub Jelinek
2017-11-28 17:43 ` Jeff Law [this message]
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=0a4d5461-2b49-6d1b-645a-8861554e64ad@redhat.com \
--to=law@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--cc=polacek@redhat.com \
--cc=rguenther@suse.de \
/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).