public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5708] ubsan: Fix up another spot that should have been BUILT_IN_UNREACHABLE_TRAPS [PR108655] Date: Mon, 6 Feb 2023 08:06:33 +0000 (GMT) [thread overview] Message-ID: <20230206080633.C7BA43858D1E@sourceware.org> (raw) https://gcc.gnu.org/g:5df573f76bb9b42231e722145033c548a5fcdf9a commit r13-5708-g5df573f76bb9b42231e722145033c548a5fcdf9a Author: Jakub Jelinek <jakub@redhat.com> Date: Mon Feb 6 09:05:56 2023 +0100 ubsan: Fix up another spot that should have been BUILT_IN_UNREACHABLE_TRAPS [PR108655] We ICE on the following testcase, because ivcanon calls gimple_build_builtin_unreachable but doesn't expect it would need vops. BUILT_IN_UNREACHABLE_TRAP I've introduced yesterday doesn't need vops and should be used in that case instead of BUILT_IN_TRAP which needs them. 2023-02-06 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/108655 * ubsan.cc (sanitize_unreachable_fn): For -funreachable-traps or -fsanitize=unreachable -fsanitize-trap=unreachable return BUILT_IN_UNREACHABLE_TRAP decl rather than BUILT_IN_TRAP. * gcc.dg/pr108655.c: New test. Diff: --- gcc/testsuite/gcc.dg/pr108655.c | 15 +++++++++++++++ gcc/ubsan.cc | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/pr108655.c b/gcc/testsuite/gcc.dg/pr108655.c new file mode 100644 index 00000000000..f407616976e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr108655.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/108655 */ +/* { dg-do compile } */ +/* { dg-options "-w -O1 -funreachable-traps" } */ + +void +foo (void) +{ + int i, j; + for (; i;) + ; + for (; i < 6;) + for (j = 0; j < 6; ++j) + i += j; + __builtin_trap (); +} diff --git a/gcc/ubsan.cc b/gcc/ubsan.cc index 6dec2c3078a..c2f2e75b300 100644 --- a/gcc/ubsan.cc +++ b/gcc/ubsan.cc @@ -649,7 +649,7 @@ sanitize_unreachable_fn (tree *data, location_t loc) ? (flag_sanitize_trap & SANITIZE_UNREACHABLE) : flag_unreachable_traps) { - fn = builtin_decl_explicit (BUILT_IN_TRAP); + fn = builtin_decl_explicit (BUILT_IN_UNREACHABLE_TRAP); *data = NULL_TREE; } else if (san)
reply other threads:[~2023-02-06 8:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230206080633.C7BA43858D1E@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).