public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: hongtao Liu <liuhongt@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5981] Fix ICE. [PR103682] Date: Tue, 14 Dec 2021 23:40:26 +0000 (GMT) [thread overview] Message-ID: <20211214234026.5381D3858D28@sourceware.org> (raw) https://gcc.gnu.org/g:a2a0c91b47537b16908981e206f4e42db8425eca commit r12-5981-ga2a0c91b47537b16908981e206f4e42db8425eca Author: liuhongt <hongtao.liu@intel.com> Date: Tue Dec 14 09:47:08 2021 +0800 Fix ICE. [PR103682] Check is_gimple_assign before gimple_assign_rhs_code. gcc/ChangeLog: PR target/103682 * tree-ssa-ccp.c (optimize_atomic_bit_test_and): Check is_gimple_assign before gimple_assign_rhs_code. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/pr103682.c: New test. Diff: --- gcc/testsuite/gcc.c-torture/compile/pr103682.c | 3 +++ gcc/tree-ssa-ccp.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.c-torture/compile/pr103682.c b/gcc/testsuite/gcc.c-torture/compile/pr103682.c new file mode 100644 index 00000000000..5ee4b21f7e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr103682.c @@ -0,0 +1,3 @@ +int bug(unsigned *ready, unsigned u) { + return __atomic_fetch_and (ready, ~u, 0) & u; +} diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 9e12da8f011..a5b1f60f979 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -3703,8 +3703,8 @@ optimize_atomic_bit_test_and (gimple_stmt_iterator *gsip, g = SSA_NAME_DEF_STMT (mask); } - rhs_code = gimple_assign_rhs_code (g); - if (rhs_code != LSHIFT_EXPR + if (!is_gimple_assign (g) + || gimple_assign_rhs_code (g) != LSHIFT_EXPR || !integer_onep (gimple_assign_rhs1 (g))) return; bit = gimple_assign_rhs2 (g);
reply other threads:[~2021-12-14 23:40 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=20211214234026.5381D3858D28@sourceware.org \ --to=liuhongt@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).