[PATCH] Fix column information for omp_clauses in Fortran code

Thomas Schwinge thomas@codesourcery.com
Tue Nov 3 08:26:14 GMT 2020


On 2019-12-09T16:58:44+0100, "Harwath, Frederik" <frederik@codesourcery.com> wrote:
> Tobias has recently fixed a problem with the column information in gfortran locations
> ("PR 92793 - fix column used for error diagnostic").

In context of:

> [use] the location of clauses in warnings instead of the location of the loop to which the clause belongs.

..., Frederik then did:

> Subject: [PATCH] Fix column information for omp_clauses in Fortran code
> The location of all OpenMP/OpenACC clauses on any given line in Fortran code
> always points to the first clause on that line. Hence, the column information
> is wrong for all clauses but the first one.
> Use the correct location for each clause instead.

Actually, that was specific for 'reduction' clauses:

> --- a/gcc/fortran/trans-openmp.c
> +++ b/gcc/fortran/trans-openmp.c
> @@ -1982,7 +1982,7 @@ gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list,
>       tree t = gfc_trans_omp_variable (namelist->sym, false);
>       if (t != error_mark_node)
>         {
> -         tree node = build_omp_clause (gfc_get_location (&where),
> +         tree node = build_omp_clause (gfc_get_location (&namelist->where),
>                                         OMP_CLAUSE_REDUCTION);

Similar changes are desirable for other directives/clauses, too.

I've just pushed "[Fortran] More precise location information for OpenACC
'gang', 'worker', 'vector' clauses with argument [PR92793]" to master
branch in commit 41f7f6178e2d35288273656dc55dae8fcf3edeb5, and backported
to releases/gcc-10 in commit 5ceaf8a54abb3f9bd3c268fe420999a7962b2a15,
see attached.


Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-More-precise-location-information-for-OpenAC.patch
Type: text/x-diff
Size: 7314 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201103/38c9d3b8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-More-precise-location-information-for-Op.g10.patch
Type: text/x-diff
Size: 7384 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201103/38c9d3b8/attachment-0001.bin>

More information about the Gcc-patches mailing list