public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: mscfd <mscfd@gmx.net>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re:
Date: Thu, 11 Mar 2021 08:48:23 +0100	[thread overview]
Message-ID: <CAFiYyc1XrNT+Jy_a=2CTOWuRWuzn_y3acbKrmdPFskm4R9fgSw@mail.gmail.com> (raw)
In-Reply-To: <856aeaf7-defa-4797-a0e2-d4d5e07f5cc6@gmx.net>

On Wed, Mar 10, 2021 at 8:39 PM mscfd via Fortran <fortran@gcc.gnu.org> wrote:
>
> > which version of gfortran, and which operating system?
> I have seen this on two different Linux distros on x86 with a recently compiled version, but also some time ago with an older gfortran 10 version.
>
> 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. There a newunits array 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 into character variable is done. Now "newunit_alloc" uses a lock to avoid having several thread all over the place. But newunit_free also writes to newunits array. And this routine does not obtain a lock itself (see comment in unit.c) So in theory it can happen that newunit_alloc reallocated newunits, and newunit_free writes to it just at this time. As I also use 18 threads the initial size of 16 does not suffice and reallocation does probably indeed happen.
> Also acces to newunit_lwi is not protected as well (and complained about by helgrind).
>
> 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 much).
>
> Any thoughts?

try obtaining the locks around the places you figured and see if your
problem goes away?

> Martin

  reply	other threads:[~2021-03-11  7:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 18:34 mscfd
2021-03-11  7:48 ` Richard Biener [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-22 13:06 Mamadou Diop
2023-08-23  8:19 ` Arjen Markus
2020-07-26  4:49 Damian Rouson
2020-07-26  8:55 ` Arjen Markus
2013-03-13  5:51 Re: DavidLNewton
2013-03-12  9:22 Re: DavidLNewton
2007-07-06  6:27 Re: Tobias Burnus
2007-07-06  8:17 ` Re: Lee Millward
     [not found] <8C94B5ACA298987-8B4-8502@WEBMAIL-DB13.sysops.aol.com>
2007-04-12 21:00 ` Re: FX Coudert
2007-03-27 13:13 Re: Paul Richard Thomas
     [not found] <4195D82C2DB1D211B9910008C7C9B06F01F373E0@lr0nt3.lr.tudelft.nl>
2003-12-07 14:17 ` Re: Paul Brook

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='CAFiYyc1XrNT+Jy_a=2CTOWuRWuzn_y3acbKrmdPFskm4R9fgSw@mail.gmail.com' \
    --to=richard.guenther@gmail.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).