public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org, richard.guenther@gmail.com,
	jwakely.gcc@gmail.com
Subject: Re: [PATCH RFA] ubsan: default to trap on unreachable at -O0 and -Og [PR104642]
Date: Wed, 22 Jun 2022 10:05:58 +0200	[thread overview]
Message-ID: <YrLNZkiHzSpOu4YH@tucnak> (raw)
In-Reply-To: <32f7c45f-c70a-1b60-391a-9f642a4a0f4c@redhat.com>

On Tue, Jun 21, 2022 at 11:59:56PM -0400, Jason Merrill wrote:
> 	PR c++/104642
> 
> gcc/ChangeLog:
> 
> 	* common.opt: Add -funreachable-traps.
> 	* doc/invoke.texi (-funreachable-traps): Document it.
> 	* opts.cc (finish_options): Enable at -O0 or -Og.
> 	* tree.cc (build_common_builtin_nodes): Add __builtin_trap.
> 	(builtin_decl_unreachable, build_builtin_unreachable): New.
> 	* tree.h: Declare them.
> 	* ubsan.cc (sanitize_unreachable_fn): Factor out.
> 	(ubsan_instrument_unreachable): Use
> 	gimple_build_builtin_unreachable.
> 	* ubsan.h (sanitize_unreachable_fn): Declare.
> 	* gimple.cc (gimple_build_builtin_unreachable): New.
> 	* gimple.h: Declare it.
> 	* builtins.cc (expand_builtin_unreachable): Add assert.
> 	(fold_builtin_0): Call build_builtin_unreachable.
> 	* sanopt.cc: Don't run for just SANITIZE_RETURN
> 	or SANITIZE_UNREACHABLE when trapping.
> 	* cgraphunit.cc (walk_polymorphic_call_targets): Use new
> 	unreachable functions.
> 	* gimple-fold.cc (gimple_fold_call)
> 	(gimple_get_virt_method_for_vtable)
> 	* ipa-fnsummary.cc (redirect_to_unreachable)
> 	* ipa-prop.cc (ipa_make_edge_direct_to_target)
> 	(ipa_impossible_devirt_target)
> 	* ipa.cc (walk_polymorphic_call_targets)
> 	* tree-cfg.cc (pass_warn_function_return::execute)
> 	(execute_fixup_cfg)
> 	* tree-ssa-loop-ivcanon.cc (remove_exits_and_undefined_stmts)
> 	(unloop_loops)
> 	* tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_stmt):
> 	Likewise.
> 
> gcc/cp/ChangeLog:
> 
> 	* constexpr.cc (cxx_eval_builtin_function_call): Handle
> 	unreachable/trap earlier.
> 	* cp-gimplify.cc (cp_maybe_instrument_return): Use
> 	build_builtin_unreachable.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/ubsan/return-8a.C: New test.
> 	* g++.dg/ubsan/return-8b.C: New test.
> 	* g++.dg/ubsan/return-8d.C: New test.
> 	* g++.dg/ubsan/return-8e.C: New test.

LGTM, thanks.

	Jakub


  reply	other threads:[~2022-06-22  8:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 19:53 Jason Merrill
2022-06-14 11:44 ` Jakub Jelinek
2022-06-15 20:38   ` Jason Merrill
2022-06-16 13:14     ` Jakub Jelinek
2022-06-20 20:30       ` Jason Merrill
2022-06-21 11:17         ` Jakub Jelinek
2022-06-22  3:59           ` Jason Merrill
2022-06-22  8:05             ` Jakub Jelinek [this message]
2022-06-16 20:32   ` Jonathan Wakely
2022-06-16 20:53     ` Jakub Jelinek
2022-06-17 15:34     ` [PATCH] ubsan: Add -fsanitize-trap= support Jakub Jelinek
2022-06-17 18:21       ` Jason Merrill

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=YrLNZkiHzSpOu4YH@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely.gcc@gmail.com \
    --cc=richard.guenther@gmail.com \
    /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).