public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c Date: Mon, 04 Oct 2021 06:29:31 +0000 [thread overview] Message-ID: <bug-102285-4-3a7OXQglbW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102285-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 --- Comment #20 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 1 Oct 2021, qinzhao at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102285 > > --- Comment #18 from qinzhao at gcc dot gnu.org --- > (In reply to Richard Biener from comment #13) > > We could try sth like the following which should cover this testcase and > > also hopefully doesn't break anything else. > > > > diff --git a/gcc/expr.c b/gcc/expr.c > > index e0bcbccd905..ab3b5b26c20 100644 > > --- a/gcc/expr.c > > +++ b/gcc/expr.c > > @@ -5322,7 +5322,7 @@ non_mem_decl_p (tree base) > > /* Returns true if REF refers to an object that does not > > reside in memory and has non-BLKmode. */ > > > > -static inline bool > > +bool > > mem_ref_refers_to_non_mem_p (tree ref) > > { > > tree base; > > diff --git a/gcc/expr.h b/gcc/expr.h > > index 94a85b40dca..85650e96834 100644 > > --- a/gcc/expr.h > > +++ b/gcc/expr.h > > @@ -346,4 +346,6 @@ extern void expand_operands (tree, tree, rtx, rtx*, rtx*, > > /* Return an rtx for the size in bytes of the value of an expr. */ > > extern rtx expr_size (tree); > > > > +extern bool mem_ref_refers_to_non_mem_p (tree ref); > > + > > #endif /* GCC_EXPR_H */ > > diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c > > index 8312d08aab2..c1d23dfd21e 100644 > > --- a/gcc/internal-fn.c > > +++ b/gcc/internal-fn.c > > @@ -3015,8 +3015,10 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt) > > reg_lhs = true; > > else > > { > > - rtx tem = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); > > - reg_lhs = !MEM_P (tem); > > + tree lhs_base = lhs; > > + while (handled_component_p (lhs_base)) > > + lhs_base = TREE_OPERAND (lhs_base, 0); > > + reg_lhs = mem_refers_to_non_mem_p (lhs_base); > > } > > > > if (!reg_lhs) > > I tried the above patch, it even doesn't work for this testing case. > After the patch, this call to .DEFERRED_INIT will be expanded through REG path, > however, the existing problem in the LHS IR broke the "expand_assignment" too. > so I see. > , I still think that the root cause is the IR for LHS of the following call > to .DEFERRED_INIT is not correct: > > MEM[(int[0:D.1993] *)&fb.3] = .DEFERRED_INIT (16, 2, 1); > > the LHS is: MEM[(int[0:D.1993] *)&fb.3] > > this is the MEM_REF, whose base address is a ADDR_EXPR of a VAR_DECL, however, > this VAR_DECL is not addressable, will be in REG. this is conflicting: how can > a variable that in a REG be address taken? It doesn't have its address taken - the ADDR_EXPR is artificial when at the base of a MEM_REF. Let me thake this bug then.
next prev parent reply other threads:[~2021-10-04 6:29 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-10 21:50 [Bug c/102285] New: New flag -ftrivial-auto-var-init=zero causes many crashes in the testsuite dcb314 at hotmail dot com 2021-09-10 22:11 ` [Bug middle-end/102285] " qinzhao at gcc dot gnu.org 2021-09-10 22:28 ` qinzhao at gcc dot gnu.org 2021-09-10 22:34 ` pinskia at gcc dot gnu.org 2021-09-10 23:10 ` qing.zhao at oracle dot com 2021-09-12 3:33 ` qinzhao at gcc dot gnu.org 2021-09-12 8:06 ` dcb314 at hotmail dot com 2021-09-13 10:25 ` rguenth at gcc dot gnu.org 2021-09-13 17:30 ` qinzhao at gcc dot gnu.org 2021-09-29 22:44 ` [Bug middle-end/102285] New flag -ftrivial-auto-var-init=zero causes crash in pr82421.c qinzhao at gcc dot gnu.org 2021-09-30 19:30 ` qinzhao at gcc dot gnu.org 2021-09-30 20:22 ` qinzhao at gcc dot gnu.org 2021-09-30 20:53 ` dcb314 at hotmail dot com 2021-09-30 22:09 ` qinzhao at gcc dot gnu.org 2021-10-01 6:51 ` rguenth at gcc dot gnu.org 2021-10-01 9:45 ` egallager at gcc dot gnu.org 2021-10-01 16:16 ` qinzhao at gcc dot gnu.org 2021-10-01 16:43 ` qing.zhao at oracle dot com 2021-10-01 20:09 ` qinzhao at gcc dot gnu.org 2021-10-01 20:23 ` qinzhao at gcc dot gnu.org 2021-10-04 6:27 ` rguenther at suse dot de 2021-10-04 6:29 ` rguenther at suse dot de [this message] 2021-10-04 9:10 ` rguenth at gcc dot gnu.org 2021-10-04 9:30 ` rguenth at gcc dot gnu.org 2021-10-04 11:53 ` rguenth at gcc dot gnu.org 2021-10-04 14:54 ` rguenth at gcc dot gnu.org 2021-10-04 17:16 ` qinzhao at gcc dot gnu.org 2021-10-04 20:34 ` qinzhao at gcc dot gnu.org 2021-10-04 20:59 ` qinzhao at gcc dot gnu.org 2021-10-04 21:44 ` qinzhao at gcc dot gnu.org 2021-10-05 8:36 ` cvs-commit at gcc dot gnu.org 2021-10-05 8:47 ` rguenth at gcc dot gnu.org
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=bug-102285-4-3a7OXQglbW@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).