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/98433] double free detected in tcache 2, after merge of structures Date: Sun, 23 Jul 2023 19:12:30 +0000 [thread overview] Message-ID: <bug-98433-4-oTCp3MRkNI@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 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code --- Comment #8 from anlauf at gcc dot gnu.org --- We are now generating a shallow copy instead of a deep copy for the line: x3 = merge(x1, x2, .false.) This gives: { struct t D.4345; struct t D.4346; struct t D.4347; D.4345 = x1; D.4346 = x2; D.4347 = x3; x3 = D.4346; if ((real(kind=4)[0:] * restrict) D.4347.v.data != 0B) { __builtin_free ((void *) D.4347.v.data); (real(kind=4)[0:] * restrict) D.4347.v.data = 0B; } } while e.g. the assignment x3 = x2 produces: ... x3 = x2; if ((void *) x2.v.data != 0B) { D.4346 = (x2.v.dim[0].ubound - x2.v.dim[0].lbound) + 1; D.4347 = NON_LVALUE_EXPR <D.4346>; D.4348 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long) (D.4347 * 4), 1>); x3.v.data = D.4348; __builtin_memcpy ((real(kind=4)[0:] * restrict) x3.v.data, (real(kind=4)[0:] * restrict) x2.v.data, (unsigned long) (D.4347 * 4)); } else { x3.v.data = 0B; } ...
prev parent reply other threads:[~2023-07-23 19:12 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 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 [this message]
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-oTCp3MRkNI@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).