Prior to this patch, when the Fortran FE detected an invalid argument to the OpenACC wait directive, it was trying to read the location of the expression after it checked does not exist to error diagnostics. This patch resolves that issue by reporting the error using %C.
I'll commit this patch to trunk as obvious. Cesar
2018-06-13 Cesar Philippidis <ce...@codesourcery.com> PR fortran/85702 gcc/fortran/ * openmp.c (gfc_match_oacc_wait): Use %C to report error location. gcc/testsuite/ * gfortran.dg/goacc/pr85702.f90: New test. >From 07022efa1ba4a58fa12c3f8a3b911fba32a5df1b Mon Sep 17 00:00:00 2001 From: Cesar Philippidis <ce...@codesourcery.com> Date: Mon, 11 Jun 2018 14:03:47 -0700 Subject: [PATCH] fix PR85702 --- gcc/fortran/openmp.c | 3 +-- gcc/testsuite/gfortran.dg/goacc/pr85702.f90 | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/goacc/pr85702.f90 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 5c13312..97d6e78 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2177,8 +2177,7 @@ gfc_match_oacc_wait (void) { if (el->expr == NULL) { - gfc_error ("Invalid argument to !$ACC WAIT at %L", - &wait_list->expr->where); + gfc_error ("Invalid argument to !$ACC WAIT at %C"); return MATCH_ERROR; } diff --git a/gcc/testsuite/gfortran.dg/goacc/pr85702.f90 b/gcc/testsuite/gfortran.dg/goacc/pr85702.f90 new file mode 100644 index 0000000..7488618 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/pr85702.f90 @@ -0,0 +1,6 @@ +! PR fortran/85702 +! { dg-do compile } + +subroutine s + !$acc wait(*) ! { dg-error "Invalid argument to ..ACC WAIT" } +end -- 2.7.4