diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2020-10-27 17:14:10 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2020-11-03 09:13:07 +0100 |
commit | 41f7f6178e2d35288273656dc55dae8fcf3edeb5 (patch) | |
tree | 089751fca69257eabb151eabd06023b1a959f1b7 /gcc/fortran/trans-openmp.c | |
parent | beddd1762ad2bbe84dd776c54489153f83f21e56 (diff) | |
download | gcc-41f7f6178e2d35288273656dc55dae8fcf3edeb5.zip gcc-41f7f6178e2d35288273656dc55dae8fcf3edeb5.tar.gz gcc-41f7f6178e2d35288273656dc55dae8fcf3edeb5.tar.bz2 |
[Fortran] More precise location information for OpenACC 'gang', 'worker', 'vector' clauses with argument [PR92793]
gcc/fortran/
PR fortran/92793
* trans-openmp.c (gfc_trans_omp_clauses): More precise location
information for OpenACC 'gang', 'worker', 'vector' clauses with
argument.
gcc/testsuite/
PR fortran/92793
* gfortran.dg/goacc/pr92793-1.f90: Adjust.
Diffstat (limited to 'gcc/fortran/trans-openmp.c')
-rw-r--r-- | gcc/fortran/trans-openmp.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index d02949e..1d652a0 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -3771,34 +3771,38 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, } if (clauses->vector) { + c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_VECTOR); + omp_clauses = gfc_trans_add_clause (c, omp_clauses); + if (clauses->vector_expr) { tree vector_var = gfc_convert_expr_to_tree (block, clauses->vector_expr); - c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_VECTOR); OMP_CLAUSE_VECTOR_EXPR (c) = vector_var; - omp_clauses = gfc_trans_add_clause (c, omp_clauses); - } - else - { - c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_VECTOR); - omp_clauses = gfc_trans_add_clause (c, omp_clauses); + + /* TODO: We're not capturing location information for individual + clauses. However, if we have an expression attached to the + clause, that one provides better location information. */ + OMP_CLAUSE_LOCATION (c) + = gfc_get_location (&clauses->vector_expr->where); } } if (clauses->worker) { + c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_WORKER); + omp_clauses = gfc_trans_add_clause (c, omp_clauses); + if (clauses->worker_expr) { tree worker_var = gfc_convert_expr_to_tree (block, clauses->worker_expr); - c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_WORKER); OMP_CLAUSE_WORKER_EXPR (c) = worker_var; - omp_clauses = gfc_trans_add_clause (c, omp_clauses); - } - else - { - c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_WORKER); - omp_clauses = gfc_trans_add_clause (c, omp_clauses); + + /* TODO: We're not capturing location information for individual + clauses. However, if we have an expression attached to the + clause, that one provides better location information. */ + OMP_CLAUSE_LOCATION (c) + = gfc_get_location (&clauses->worker_expr->where); } } if (clauses->gang) @@ -3806,11 +3810,19 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, tree arg; c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_GANG); omp_clauses = gfc_trans_add_clause (c, omp_clauses); + if (clauses->gang_num_expr) { arg = gfc_convert_expr_to_tree (block, clauses->gang_num_expr); OMP_CLAUSE_GANG_EXPR (c) = arg; + + /* TODO: We're not capturing location information for individual + clauses. However, if we have an expression attached to the + clause, that one provides better location information. */ + OMP_CLAUSE_LOCATION (c) + = gfc_get_location (&clauses->gang_num_expr->where); } + if (clauses->gang_static) { arg = clauses->gang_static_expr |