public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4101] middle-end/107679 - fix SSA rewrite of clobber of parameter Date: Wed, 16 Nov 2022 16:07:58 +0000 (GMT) [thread overview] Message-ID: <20221116160758.090C9395B43F@sourceware.org> (raw) https://gcc.gnu.org/g:8a5f3663f8de45b7030dfe7ce962783dc1a19885 commit r13-4101-g8a5f3663f8de45b7030dfe7ce962783dc1a19885 Author: Richard Biener <rguenther@suse.de> Date: Wed Nov 16 13:57:14 2022 +0100 middle-end/107679 - fix SSA rewrite of clobber of parameter When the frontend clobbers a parameter and that parameter gets rewritten into SSA then we ICE because we didn't expect this. Avoid using the parameter decl to create a SSA default def in this case. PR middle-end/107679 * tree-into-ssa.cc (maybe_register_def): Use new temporary if we require an uninitialized value for a parameter decl. * gfortran.dg/pr107679.f90: New testcase. Diff: --- gcc/testsuite/gfortran.dg/pr107679.f90 | 9 +++++++++ gcc/tree-into-ssa.cc | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gfortran.dg/pr107679.f90 b/gcc/testsuite/gfortran.dg/pr107679.f90 new file mode 100644 index 00000000000..33a52fb5ef2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr107679.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } + +subroutine s1(x) + integer, intent(out) :: x +end +subroutine s2(z) + integer, value :: z + call s1(z) +end diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc index d13fb720b37..f21ed2bea3f 100644 --- a/gcc/tree-into-ssa.cc +++ b/gcc/tree-into-ssa.cc @@ -1911,13 +1911,17 @@ maybe_register_def (def_operand_p def_p, gimple *stmt, { if (gimple_clobber_p (stmt) && is_gimple_reg (sym)) { - gcc_checking_assert (VAR_P (sym)); + tree defvar; + if (VAR_P (sym)) + defvar = sym; + else + defvar = create_tmp_reg (TREE_TYPE (sym)); /* Replace clobber stmts with a default def. This new use of a default definition may make it look like SSA_NAMEs have conflicting lifetimes, so we need special code to let them coalesce properly. */ to_delete = true; - def = get_or_create_ssa_default_def (cfun, sym); + def = get_or_create_ssa_default_def (cfun, defvar); } else {
reply other threads:[~2022-11-16 16:07 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=20221116160758.090C9395B43F@sourceware.org \ --to=rguenth@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).