On 07.12.22 20:09, Julian Brown wrote:
On Wed, 26 Oct 2022 12:39:39 +0200
Tobias Burnus <tob...@codesourcery.com> wrote:
The ICE seems to be because gcc/fortran/trans-openmp.cc's
gfc_split_omp_clauses mishandles this as the dump shows the following:

    #pragma omp target firstprivate(a) map(tofrom:a)
          #pragma omp parallel firstprivate(a)

In contrast, for the C testcase:

#pragma omp target parallel for simd map(x) firstprivate(x)

the dump is as follows, which seems to be sensible:

    #pragma omp target map(tofrom:x)
          #pragma omp parallel firstprivate(x)
This patch fixes a case where a combined directive (e.g. "!$omp target
parallel ...") contains both a map and a firstprivate clause for the
same variable.  When the combined directive is split into two nested
directives, the outer "target" gets the "map" clause, and the inner
"parallel" gets the "firstprivate" clause, like so:
...
This is not a recent regression, but appears to fix a long-standing ICE.
...
gcc/fortran/
         * trans-openmp.cc (gfc_add_firstprivate_if_unmapped): New function.
         (gfc_split_omp_clauses): Call above.

libgomp/
         * testsuite/libgomp.fortran/combined-directive-splitting-1.f90: New
         test.

LGTM – thanks!

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to