public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/110288] [11/12/13/14] Regression: segfault in findloc with allocatable array of allocatable characters Date: Tue, 11 Jul 2023 18:21:57 +0000 [thread overview] Message-ID: <bug-110288-4-oECawSk2Br@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110288-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110288 --- Comment #4 from anlauf at gcc dot gnu.org --- The patch in comment#3 tries to fix a symptom and is wrong. The true cause is the attempt to derive the formal argument typespec from the actual for intrinsics. This mistreats character, as the actual might be deferred-length. Better fix: diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc index 37a9e8fa0ae..18d0fde8319 100644 --- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -4725,6 +4731,13 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src, formal_arg->sym->attr.flavor = FL_VARIABLE; formal_arg->sym->attr.dummy = 1; + /* Be careful not to treat an actual deferred-length character + argument wrongly as template for the formal argument. */ + if (formal_arg->sym->ts.type == BT_CHARACTER + && !(formal_arg->sym->attr.allocatable + || formal_arg->sym->attr.pointer)) + formal_arg->sym->ts.deferred = false; + if (formal_arg->sym->ts.type == BT_CHARACTER) formal_arg->sym->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL); Regtests OK.
next prev parent reply other threads:[~2023-07-11 18:21 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-16 14:46 [Bug fortran/110288] New: [11/12/13] " zed.three at gmail dot com 2023-06-16 16:38 ` [Bug fortran/110288] [11/12/13/14] " anlauf at gcc dot gnu.org 2023-07-09 20:38 ` anlauf at gcc dot gnu.org 2023-07-10 20:50 ` anlauf at gcc dot gnu.org 2023-07-11 18:21 ` anlauf at gcc dot gnu.org [this message] 2023-07-11 19:40 ` anlauf at gcc dot gnu.org 2023-07-11 20:26 ` cvs-commit at gcc dot gnu.org 2023-07-13 17:38 ` anlauf at gcc dot gnu.org 2023-07-14 18:27 ` cvs-commit at gcc dot gnu.org 2023-07-14 18:32 ` cvs-commit at gcc dot gnu.org 2023-07-14 18:35 ` cvs-commit at gcc dot gnu.org 2023-07-14 18:39 ` anlauf 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-110288-4-oECawSk2Br@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).