public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99529] New: libgfortran I/O: Data races related to new unit / new unit calls for I/O to strings
@ 2021-03-10 21:10 burnus at gcc dot gnu.org
  2021-03-10 21:30 ` [Bug fortran/99529] " burnus at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-10 21:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99529

            Bug ID: 99529
           Summary: libgfortran I/O: Data races related to new unit / new
                    unit calls for I/O to strings
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jvdelisle at gcc dot gnu.org
  Target Milestone: ---

Reported at https://gcc.gnu.org/pipermail/fortran/2021-March/055795.html

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 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.

Routine "newunit_alloc" uses a lock to avoid having several
threads all over the place. But newunit_free also
writes to newunits array. And this routine does not
obtain a lock itself (see comment above newunit_free
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 access to newunit_lwi is not protected as well
(and complained about by helgrind).

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-15 13:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 21:10 [Bug fortran/99529] New: libgfortran I/O: Data races related to new unit / new unit calls for I/O to strings burnus at gcc dot gnu.org
2021-03-10 21:30 ` [Bug fortran/99529] " burnus at gcc dot gnu.org
2021-03-11  8:30 ` 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

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).