From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 71BD93858D3C; Mon, 24 Jan 2022 12:54:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71BD93858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=mentor.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: 8dBnIVgt6jexwZI2Lbz0kZqLRo1zeCVCKXtWt0IO0IPylc9li2h8Jo4eskelHF5a1eHB0Vgv/x hNmQxX2DThe1h1LGZPKSoIHJXXX6rQpHuwdJNKdNkf0alqhIRLQISAcOMb/uHyLq5m2l6F8IgT SBVUpMaUwEpVmIj0Fbmjex8RUtSfDJuHbcq9ekSxa8TpdflhX4YCIHRSlxyfa3mQGJ2gNkFBap fKsHqwl2CfRa3Xn+z3NTYLABP4tWcm7q+iL2+PaAsAw6gEHBHxoCshBVkWmToBv6Wsvn5eTyQe q8n99UTr6VBzToZ5muCK+7YH X-IronPort-AV: E=Sophos;i="5.88,311,1635235200"; d="scan'208";a="70980270" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 24 Jan 2022 04:54:38 -0800 IronPort-SDR: Msk2cB8E4zv61U7PLu5E0bkjj0BCcgxxAi+Wqm4qiYfQXFSs+3TZu9xHyQFrWhdGu5pz4swRa2 m7gzNF3iiDpRXzNlz0Q5NneUcqbULUPAgSW+pkrMDoTVLD4nTuXv/mZ8eL1UxcCgGmh4+NUX+w I4zX2UoNGulHOmJyNZu3pprLMSJdlROmUuisE87XwpCA1n72mW864b7QtRdowq1GeaPpSYgsFA y2umV4o24WEJfCgquZmuNrVvdtjnd66RaSQx4Y14oonmb5o5Z9v8EqxmTaBlTtNIEBaEgxBd8a OFo= Subject: Re: [PATCH] [gfortran] Add support for allocate clause (OpenMP 5.0). To: Tobias Burnus , Thomas Schwinge , Hafiz Abid Qadeer CC: Jakub Jelinek , , References: <20211022130502.2211568-1-abidh@codesourcery.com> <20211102162714.GF304296@tucnak> <20211220200650.GN2646553@tucnak> <8735lh6mcx.fsf@euler.schwinge.homeip.net> <48d8c123-fa4f-d4a3-17de-b082de32f0bf@codesourcery.com> From: Hafiz Abid Qadeer Message-ID: Date: Mon, 24 Jan 2022 12:54:27 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mon, 24 Jan 2022 12:54:42 -0000 On 24/01/2022 08:45, Tobias Burnus wrote: > On 21.01.22 18:43, Tobias Burnus wrote: >> On 21.01.22 18:15, Thomas Schwinge wrote: >>>         11 |     integer(c_int) function is_64bit_aligned (a) bind(C) >>>      Warning: Variable ‘a’ at (1) is a dummy argument of the BIND(C) procedure ‘is_64bit_aligned’ >>> but may not be C interoperable [-Wc-binding-type] >>> >>> Is that something to worry about? > I have attached a patch (not commited), which silences the three kind of warnings and fixes the > interface issue. > TODO: commit it. > > On 21.01.22 18:15, Thomas Schwinge wrote: >> I'm seeing this test case randomly/non-deterministically FAIL to execute, >> differently on different systems and runs, for example: [...] >> I'd assume there's some concurrency issue: the problem disappears if I >> manually specify a lowerish 'OMP_NUM_THREADS' > > If one compiles the program with -fsanitize=thread, it shows tons of errors :-( > The first one is: > > WARNING: ThreadSanitizer: data race (pid=3034413) >   Read of size 8 at 0x7fff8b5a8340 by thread T1: >     #0 __m_MOD_foo._omp_fn.2 ../../libgomp/testsuite/libgomp.fortran/allocate-1.f90:116 > (a.out+0x402a88) >     #1 gomp_thread_start ../../../repos/gcc-trunk-commit/libgomp/team.c:129 (libgomp.so.1+0x1e5ed) > >   Previous write of size 8 at 0x7fff8b5a8340 by main thread: >     #0 __m_MOD_foo._omp_fn.1 ../../libgomp/testsuite/libgomp.fortran/allocate-1.f90:116 > (a.out+0x4029c0) >     #1 GOMP_teams_reg ../../../repos/gcc-trunk-commit/libgomp/teams.c:51 (libgomp.so.1+0x3638c) >     #2 MAIN__ ../../libgomp/testsuite/libgomp.fortran/allocate-1.f90:328 (a.out+0x4024c0) >     #3 main ../../libgomp/testsuite/libgomp.fortran/allocate-1.f90:312 (a.out+0x4025b0) > >   Location is stack of main thread. > >   Location is global '' at 0x000000000000 ([stack]+0x1f340) > >   Thread T1 (tid=3034416, running) created by main thread at: >     #0 pthread_create > ../../../../repos/gcc-trunk-commit/libsanitizer/tsan/tsan_interceptors_posix.cpp:1001 > (libtsan.so.2+0x62c76) >     #1 gomp_team_start ../../../repos/gcc-trunk-commit/libgomp/team.c:858 (libgomp.so.1+0x1ec18) >     #2 MAIN__ ../../libgomp/testsuite/libgomp.fortran/allocate-1.f90:328 (a.out+0x4024c0) >     #3 main ../../libgomp/testsuite/libgomp.fortran/allocate-1.f90:312 (a.out+0x4025b0) > > SUMMARY: ThreadSanitizer: data race ../../libgomp/testsuite/libgomp.fortran/allocate-1.f90:116 in > __m_MOD_foo._omp_fn.2 > > Tobias @Tobias: Thanks for your comments and the patch. @Thomas: Thanks for reporting the problem. Did you notice similar behavior with libgomp/testsuite/libgomp.c-c++-common/allocate-1.c? It was used as base for fortran testcase and it shows similar warnings with -fthread=sanitize. I am trying to figure out if the problem you observed is a general one or just specific to fortran testcase. -- Hafiz Abid Qadeer Mentor, a Siemens Business