public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99529] libgfortran I/O: Data races related to new unit / new unit calls for I/O to strings Date: Wed, 10 Mar 2021 21:30:51 +0000 [thread overview] Message-ID: <bug-99529-4-kkAZgjAijZ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99529-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99529 --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> --- Regarding calling newunit_alloc, that's due to libgfortran/io/unit.c's: get_unit (st_parameter_dt *dtp, int do_create) { gfc_unit *unit; if ((dtp->common.flags & IOPARM_DT_HAS_INTERNAL_UNIT) != 0) { int kind; if (dtp->common.unit == GFC_INTERNAL_UNIT) kind = 1; else if (dtp->common.unit == GFC_INTERNAL_UNIT4) kind = 4; else internal_error (&dtp->common, "get_unit(): Bad internal unit KIND"); dtp->u.p.unit_is_internal = 1; dtp->common.unit = newunit_alloc (); unit = get_gfc_unit (dtp->common.unit, do_create); set_internal_unit (dtp, unit, kind); fbuf_init (unit, 128); return unit; } * * * >From reading the report & looking at the code superficially, it seems as if a patch is needed like: diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 27bee9d4e01..a6f115d5803 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -4360,3 +4360,5 @@ st_read_done_worker (st_parameter_dt *dtp) } + LOCK (&unit_lock); newunit_free (dtp->common.unit); + UNLOCK (&unit_lock); } @@ -4448,3 +4450,5 @@ st_write_done_worker (st_parameter_dt *dtp) } + LOCK (&unit_lock); newunit_free (dtp->common.unit); + UNLOCK (&unit_lock); }
next prev parent reply other threads:[~2021-03-10 21:30 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-10 21:10 [Bug fortran/99529] New: " burnus at gcc dot gnu.org 2021-03-10 21:30 ` burnus at gcc dot gnu.org [this message] 2021-03-11 8:30 ` [Bug fortran/99529] " rguenth at gcc dot gnu.org 2021-03-11 8:52 ` mscfd at gmx dot net 2021-03-11 9:07 ` mscfd at gmx dot net 2021-03-11 9:31 ` burnus at gcc dot gnu.org 2021-03-11 9:48 ` burnus at gcc dot gnu.org 2021-03-15 13:29 ` burnus 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-99529-4-kkAZgjAijZ@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).