[PATCH] [gfortran] Add support for allocate clause (OpenMP 5.0).

Hafiz Abid Qadeer abid_qadeer@mentor.com
Mon Jan 24 12:54:27 GMT 2022


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 '<null>' 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


More information about the Gcc-patches mailing list