diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2025-01-11 12:54:56 +0100 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2025-01-11 12:54:56 +0100 |
commit | 65286465b94cba6ee3d59edbc771bef0088ac46e (patch) | |
tree | afdaf6720ae1198f1e8b56e0e82ab38f585062d4 /gcc/fortran/trans-decl.cc | |
parent | d64ca15351029164bac30b49fb3c4f9723e755de (diff) | |
download | gcc-65286465b94cba6ee3d59edbc771bef0088ac46e.zip gcc-65286465b94cba6ee3d59edbc771bef0088ac46e.tar.gz gcc-65286465b94cba6ee3d59edbc771bef0088ac46e.tar.bz2 |
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.
Diffstat (limited to 'gcc/fortran/trans-decl.cc')
-rw-r--r-- | gcc/fortran/trans-decl.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index 814a205..4ae22a5 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -2412,7 +2412,7 @@ module_sym: type = gfc_get_function_type (sym, actual_args, fnspec); - fndecl = build_decl (input_location, + fndecl = build_decl (gfc_get_location (&sym->declared_at), FUNCTION_DECL, name, type); /* Initialize DECL_EXTERNAL and TREE_PUBLIC before calling decl_attributes; |