public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r9-9627] Fortran - ICE in gfc_conv_expr_present initializing non-dummy class variable Date: Fri, 16 Jul 2021 19:54:22 +0000 (GMT) [thread overview] Message-ID: <20210716195422.94330385E007@sourceware.org> (raw) https://gcc.gnu.org/g:1847a11f4ad8960a57384ed1ef2d0292c65166ed commit r9-9627-g1847a11f4ad8960a57384ed1ef2d0292c65166ed Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Jul 14 17:25:29 2021 +0200 Fortran - ICE in gfc_conv_expr_present initializing non-dummy class variable gcc/fortran/ChangeLog: PR fortran/100949 * trans-expr.c (gfc_trans_class_init_assign): Call gfc_conv_expr_present only for dummy variables. gcc/testsuite/ChangeLog: PR fortran/100949 * gfortran.dg/pr100949.f90: New test. (cherry picked from commit 269ca408e2839d7f3554a91515d73d4d95352f68) Diff: --- gcc/fortran/trans-expr.c | 5 +++-- gcc/testsuite/gfortran.dg/pr100949.f90 | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 9be8dd185bf..59ffd071430 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1655,8 +1655,9 @@ gfc_trans_class_init_assign (gfc_code *code) } } - if (code->expr1->symtree->n.sym->attr.optional - || code->expr1->symtree->n.sym->ns->proc_name->attr.entry_master) + if (code->expr1->symtree->n.sym->attr.dummy + && (code->expr1->symtree->n.sym->attr.optional + || code->expr1->symtree->n.sym->ns->proc_name->attr.entry_master)) { tree present = gfc_conv_expr_present (code->expr1->symtree->n.sym); tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (tmp), diff --git a/gcc/testsuite/gfortran.dg/pr100949.f90 b/gcc/testsuite/gfortran.dg/pr100949.f90 new file mode 100644 index 00000000000..6c736fd7f72 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr100949.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/100949 - ICE in gfc_conv_expr_present, at fortran/trans-expr.c:1975 + +subroutine s +entry f + type t + end type + class(t), allocatable :: y, z + allocate (z, mold=y) +end
reply other threads:[~2021-07-16 19:54 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=20210716195422.94330385E007@sourceware.org \ --to=anlauf@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).