public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "guez at lmd dot ens.fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98433] double free detected in tcache 2, after merge of structures Date: Wed, 23 Dec 2020 23:29:47 +0000 [thread overview] Message-ID: <bug-98433-4-upwz3X7O4J@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98433-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98433 --- Comment #2 from Lionel GUEZ <guez at lmd dot ens.fr> --- Sure, the issue goes away if you specify the components. When you say "the likely correct line", do you imply that the line without the components is incorrect? I would insist that the line without the components is correct. See for example Adams, Fortran 2003 Handbook, 2009, section 7.5.2: "Derived-type intrinsic assignment is performed as if the assignment were expanded, component-by-component with corresponding elements from the variable and the expression, into separate assignment statements. [...] If the component is allocatable: a. if it is allocated, it is deallocated. b. if the corresponding component of the expression is allocated, the variable component is allocated with the same dynamic type and type parameters and, if it is an array, with the same bounds. [...]" gfortran usually implements this well, as we can see when we replace the merge with a simple x3 = x2. But there is something wrong here in gfortran when it encounters the combination of derived-type assignment, merge function, and being in a subroutine. Since the line without the components is valid, the crash is a bug. (I might add that, of course, I produced the simplest possible test case but, in my original program, the allocatable component in the derived type is only one of several components and so, it is not an equivalently satisfying code to manually assign all components one by one.)
next prev parent reply other threads:[~2020-12-23 23:29 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-23 22:18 [Bug fortran/98433] New: " guez at lmd dot ens.fr 2020-12-23 22:43 ` [Bug fortran/98433] " kargl at gcc dot gnu.org 2020-12-23 23:29 ` guez at lmd dot ens.fr [this message] 2020-12-24 0:52 ` sgk at troutmask dot apl.washington.edu 2020-12-24 7:55 ` guez at lmd dot ens.fr 2020-12-24 12:01 ` anlauf at gcc dot gnu.org 2020-12-24 19:31 ` kargl at gcc dot gnu.org 2020-12-24 23:03 ` guez at lmd dot ens.fr 2023-07-23 19:12 ` 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-98433-4-upwz3X7O4J@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).