From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8D0E1386EC42; Thu, 11 Mar 2021 09:31:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D0E1386EC42 From: "burnus at gcc dot 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: Thu, 11 Mar 2021 09:31:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 09:31:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99529 --- Comment #5 from Tobias Burnus --- (In reply to martin from comment #4) > Ok, here is another suspicious data race in unit.c (backtrace from helgri= nd): It looks as if - for the libgfortran internal use - it first gets the unit based on that number =E2=80=93 and then sets it again. Namely, the call is: unit =3D get_gfc_unit (dtp->common.unit, do_create); set_internal_unit (dtp, unit, kind); Just to make sure, I add an assert - but I think the line can also be remov= ed for good. --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -459 +459 @@ set_internal_unit (st_parameter_dt *dtp, gfc_unit *iunit, i= nt kind) - iunit->unit_number =3D dtp->common.unit; + assert (iunit->unit_number =3D=3D dtp->common.unit);=