public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: mscfd <mscfd@gmx.net>, <fortran@gcc.gnu.org>
Subject: Re: Data race within write intrinsic with output into a character variable
Date: Wed, 10 Mar 2021 22:38:46 +0100	[thread overview]
Message-ID: <a4117cb7-1af0-970b-0908-bed05334d69c@codesourcery.com> (raw)
In-Reply-To: <trinity-b8643f61-44c1-4166-a524-b8d5e3d60ed9-1615408826064@3c-app-gmx-bap07>

Hi Martin,

On 10.03.21 21:40, mscfd via Fortran wrote:
> Using helgrind on a simple omp do loop with write to
> a character variable, I get some possible data races
> in libgfortran/io/unit.c.

[...]

Thanks for digging. I have filled https://gcc.gnu.org/PR99529

> There global array newunits is
> allocated and possibly reallocated in
> "newunit_alloc". According to the lock outputs from
> helgrind I see that this routine is called even if
> output is into a character variable. [...]
Concur - I don't know why this is needed (it is clearly done in
purpose), but I only know libgfortran's I/O superficially.
> Could it be that the corresponding write routine in
> transfer.c which calls newunit_free does not obtain
> the necessary lock. I cannot find it (which does not
> count for much).

Glancing at the code, I came to the same conclusion (see patch in the
linked PR). But I have not tried whether it helps. But at least it compiles.

Thus, if you could test whether it helps on your side? Otherwise, I hope
that Jerry chimes in.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

  reply	other threads:[~2021-03-10 21:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 20:40 mscfd
2021-03-10 21:38 ` Tobias Burnus [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-10 11:35 Martin Stein
2021-03-10 15:41 ` Kay Diederichs

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=a4117cb7-1af0-970b-0908-bed05334d69c@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=mscfd@gmx.net \
    /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: link
Be 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).