From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A58253858D29; Mon, 15 Mar 2021 13:29:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A58253858D29 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: Mon, 15 Mar 2021 13:29:17 +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: RESOLVED X-Bugzilla-Resolution: FIXED 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: resolution bug_status 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: Mon, 15 Mar 2021 13:29:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99529 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #7 from Tobias Burnus --- Missed to add a PR fortran/99529, hence, the commit did not show up: r11-7647-ga6e9633ccb593937fceec67fafc2afe5d518d735 commit a6e9633ccb593937fceec67fafc2afe5d518d735 Author: Tobias Burnus Date: Fri Mar 12 16:31:32 2021 +0100 Fortran: Fix libgfortran I/O race with newunit_free [PR99529] libgfortran/ChangeLog: * io/transfer.c (st_read_done_worker, st_write_done_worker): Call unlock_unit here, add unit_lock lock around newunit_free c= all. (st_read_done, st_write_done): Only call unlock_unit when not calling the worker function. * io/unit.c (set_internal_unit): Don't reset the unit_number to the same number as this cause race warnings. * * * Committed patch was the revised version https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566600.html Martin (who reported the issue + helped debugging it) wrote in one of the e= mail threads: "BTW, I will do some more tests, but it looks like the patch fixes the memory corruption issue." Thus, hopefully, this issue is fixed for good. Thanks to all involved for t= he help! =E2=86=92 Close as FIXED (on mainline, GCC 11).=