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 via email to