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 r10-10076] Fortran: Allow pointer deferred length associate selectors. [PR93794] Date: Sat, 28 Aug 2021 19:49:43 +0000 (GMT) [thread overview] Message-ID: <20210828194943.830BE3858D29@sourceware.org> (raw) https://gcc.gnu.org/g:803918dc6da9b7c88cc97635fc8a21bbd805a120 commit r10-10076-g803918dc6da9b7c88cc97635fc8a21bbd805a120 Author: Paul Thomas <pault@gcc.gnu.org> Date: Fri Jan 8 10:15:22 2021 +0000 Fortran: Allow pointer deferred length associate selectors. [PR93794] 2021-01-05 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/93794 * trans-expr.c (gfc_conv_component_ref): Remove the condition that deferred character length components only be allocatable. gcc/testsuite/ PR fortran/93794 * gfortran.dg/deferred_character_35.f90 : New test. (cherry picked from commit 21c1a30fc73105af50c5e717cb99dc3becabf8fa) Diff: --- gcc/fortran/trans-expr.c | 2 +- gcc/testsuite/gfortran.dg/deferred_character_35.f90 | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index cb901437965..dbe6344db99 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2670,7 +2670,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref) /* Allocatable deferred char arrays are to be handled by the gfc_deferred_ strlen () conditional below. */ if (c->ts.type == BT_CHARACTER && !c->attr.proc_pointer - && !(c->attr.allocatable && c->ts.deferred) + && !c->ts.deferred && !c->attr.pdt_string) { tmp = c->ts.u.cl->backend_decl; diff --git a/gcc/testsuite/gfortran.dg/deferred_character_35.f90 b/gcc/testsuite/gfortran.dg/deferred_character_35.f90 new file mode 100644 index 00000000000..c28f52f79ff --- /dev/null +++ b/gcc/testsuite/gfortran.dg/deferred_character_35.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! Test the fix for PR93794, where the ASSOCIATE statement ICED on the +! deferred character length, pointer component. +! +! Contributed by Gerhard Steinmetz <gscfq@t-online.de> +! +program p + type t + character(:), pointer :: a + end type + type(t) :: z + character(4), target :: c = 'abcd' + z%a => c + associate (y => z%a) + print *, y + end associate +end
reply other threads:[~2021-08-28 19:49 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=20210828194943.830BE3858D29@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).