aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gcc.gnu.org>2018-12-09 13:49:20 +0100
committerThomas Schwinge <tschwinge@gcc.gnu.org>2018-12-09 13:49:20 +0100
commit5d62bfc3e7e954218fafe377324226621e47229d (patch)
treee132847c23232f6e6a11e60ce2063e3add0a3306 /gcc
parent65b5f496995864ec8d789f232ea25329fbf0bf62 (diff)
downloadgcc-5d62bfc3e7e954218fafe377324226621e47229d.zip
gcc-5d62bfc3e7e954218fafe377324226621e47229d.tar.gz
gcc-5d62bfc3e7e954218fafe377324226621e47229d.tar.bz2
Correct the reported line number in Fortran combined OpenACC directives
gcc/fortran/ * trans-openmp.c (gfc_trans_oacc_combined_directive): Set the location of combined acc loops. gcc/testsuite/ * gfortran.dg/goacc/combined-directives-3.f90: New file. Reviewed-by: Thomas Schwinge <thomas@codesourcery.com> From-SVN: r266924
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/trans-openmp.c5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/c-c++-common/goacc/combined-directives-3.c1
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/combined-directives-3.f9026
5 files changed, 39 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c6eb051..e74bda7 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-09 Cesar Philippidis <cesar@codesourcery.com>
+
+ * trans-openmp.c (gfc_trans_oacc_combined_directive): Set the
+ location of combined acc loops.
+
2018-12-09 Thomas Schwinge <thomas@codesourcery.com>
* openmp.c (resolve_oacc_loop_blocks): Remove checking of OpenACC
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index c9fc4e4..bf3f469 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -3878,6 +3878,7 @@ gfc_trans_oacc_combined_directive (gfc_code *code)
gfc_omp_clauses construct_clauses, loop_clauses;
tree stmt, oacc_clauses = NULL_TREE;
enum tree_code construct_code;
+ location_t loc = input_location;
switch (code->op)
{
@@ -3939,12 +3940,12 @@ gfc_trans_oacc_combined_directive (gfc_code *code)
else
pushlevel ();
stmt = gfc_trans_omp_do (code, EXEC_OACC_LOOP, pblock, &loop_clauses, NULL);
+ protected_set_expr_location (stmt, loc);
if (TREE_CODE (stmt) != BIND_EXPR)
stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0));
else
poplevel (0, 0);
- stmt = build2_loc (input_location, construct_code, void_type_node, stmt,
- oacc_clauses);
+ stmt = build2_loc (loc, construct_code, void_type_node, stmt, oacc_clauses);
gfc_add_expr_to_block (&block, stmt);
return gfc_finish_block (&block);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6b26f6f..19bc532 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-12-09 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gfortran.dg/goacc/combined-directives-3.f90: New file.
+
2018-12-09 Cesar Philippidis <cesar@codesourcery.com>
* c-c++-common/goacc/combined-directives-3.c: New test.
diff --git a/gcc/testsuite/c-c++-common/goacc/combined-directives-3.c b/gcc/testsuite/c-c++-common/goacc/combined-directives-3.c
index 77d4182..c6e31c26 100644
--- a/gcc/testsuite/c-c++-common/goacc/combined-directives-3.c
+++ b/gcc/testsuite/c-c++-common/goacc/combined-directives-3.c
@@ -1,5 +1,6 @@
/* Verify the accuracy of the line number associated with combined
constructs. */
+/* See also "../../gfortran.dg/goacc/combined-directives-3.f90". */
int
main ()
diff --git a/gcc/testsuite/gfortran.dg/goacc/combined-directives-3.f90 b/gcc/testsuite/gfortran.dg/goacc/combined-directives-3.f90
new file mode 100644
index 0000000..b138822
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/combined-directives-3.f90
@@ -0,0 +1,26 @@
+! Verify the accuracy of the line number associated with combined constructs.
+! See "../../c-c++-common/goacc/combined-directives-3.c".
+
+subroutine test
+ implicit none
+ integer x, y, z
+
+ !$acc parallel loop seq auto ! { dg-error "'seq' overrides other OpenACC loop specifiers" }
+ do x = 0, 10
+ !$acc loop
+ do y = 0, 10
+ end do
+ end do
+ !$acc end parallel loop
+
+ !$acc parallel loop gang auto ! { dg-error "'auto' conflicts with other OpenACC loop specifiers" }
+ do x = 0, 10
+ !$acc loop worker auto ! { dg-error "'auto' conflicts with other OpenACC loop specifiers" }
+ do y = 0, 10
+ !$acc loop vector
+ do z = 0, 10
+ end do
+ end do
+ end do
+ !$acc end parallel loop
+end subroutine test