From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 1A4AA3858001 for ; Wed, 10 Mar 2021 21:41:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1A4AA3858001 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: 7KQkVuzGIhylZzyKYTws+Dz5AF2J8mWKz/fkU4rPYX3JpVBZMeKQF2j69MPlO76nlPBPgjvprD 0gQ8gtm/AXaaozklkZXIziiVkb6MXaeSlENwLtsn3F2qEJ3LoTWKKcrVi7I7wTZYgruj9NJu8C EswP9HyrsqWsZUX9jJ/LDORF274aSIIPe6ALNJXV1em4ODQwcijus2WaYqPSHjzy0SvreBvfGv /p0hKefyH8pG0vNOpJG8TRGPfWPLWV/avPRJ1XsI+iBqK2EsiofYvXGjPZkjk27xZ2veV/wmRm whA= X-IronPort-AV: E=Sophos;i="5.81,238,1610438400"; d="scan'208";a="59098386" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 10 Mar 2021 13:38:52 -0800 IronPort-SDR: jW/eRteyC+3l55ecbbr2yHI5OyFzMHLCGJP0D/53w5eO3gmV6G3+A4xdA38O1fsywORBdZ7jLf tBXUCWd3+ppqf6GR4/fBHd7WP1vjyMh39/T55BrL1olodQ/NseaKBTvAF5oDnNz+zyKzJYZOh5 n87cc6mnC+WHVSVsttIWzOB/uUzqm3xB5tZaOtjjrCyRsTH8WC+1YaXPX1HMFqCIEJF88TaPBn Qo4S+TNkYP7f/8tY4wuvo3z8mryiwSDsTGIk/+EMZzxpEYluohyHlIOr9AAu+RGf4XkgARa4JQ wTE= Subject: Re: Data race within write intrinsic with output into a character variable To: mscfd , References: From: Tobias Burnus Message-ID: Date: Wed, 10 Mar 2021 22:38:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-05.mgc.mentorg.com (139.181.222.5) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 21:41:03 -0000 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=C3=BCnchen R= egistergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas H= eurung, Frank Th=C3=BCrauf