]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Fix location_t in gfc_get_extern_function_decl; support 'omp dispatch interop'
authorTobias Burnus <tburnus@baylibre.com>
Sat, 11 Jan 2025 11:54:56 +0000 (12:54 +0100)
committerTobias Burnus <tburnus@baylibre.com>
Sat, 11 Jan 2025 11:54:56 +0000 (12:54 +0100)
commit65286465b94cba6ee3d59edbc771bef0088ac46e
treeafdaf6720ae1198f1e8b56e0e82ab38f585062d4
parentd64ca15351029164bac30b49fb3c4f9723e755de
Fortran: Fix location_t in gfc_get_extern_function_decl; support 'omp dispatch interop'

The declaration created by gfc_get_extern_function_decl used input_location
as DECL_SOURCE_LOCATION, which gave rather odd results with 'declared here'
diagnostic. - It is much more useful to use the gfc_symbol's declated_at,
which this commit now does.

Additionally, it adds support for the 'interop' clause of OpenMP's
'dispatch' directive. As the argument order matters,
gfc_match_omp_variable_list gained a 'reverse_order' flag to use the
same order as the C/C++ parser.

gcc/fortran/ChangeLog:

* gfortran.h: Add OMP_LIST_INTEROP to the unnamed OMP_LIST_ enum.
* openmp.cc (gfc_match_omp_variable_list): Add reverse_order
boolean argument, defaulting to false.
(enum omp_mask2, OMP_DISPATCH_CLAUSES): Add OMP_CLAUSE_INTEROP.
(gfc_match_omp_clauses, resolve_omp_clauses): Handle dispatch's
'interop' clause.
* trans-decl.cc (gfc_get_extern_function_decl): Use sym->declared_at
instead input_location as DECL_SOURCE_LOCATION.
* trans-openmp.cc (gfc_trans_omp_clauses): Handle OMP_LIST_INTEROP.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Update
xfail'ed 'dg-bogus' for the better 'declared here' location.
* gfortran.dg/gomp/dispatch-11.f90: New test.
* gfortran.dg/gomp/dispatch-12.f90: New test.
gcc/fortran/gfortran.h
gcc/fortran/openmp.cc
gcc/fortran/trans-decl.cc
gcc/fortran/trans-openmp.cc
gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f
gcc/testsuite/gfortran.dg/gomp/dispatch-11.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/dispatch-12.f90 [new file with mode: 0644]