https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94120

            Bug ID: 94120
           Summary: [OpenACC] ICE in gimplify_adjust_omp_clauses_1 for
                    'declare' for variable outside scope
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, openacc
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

The following code gives an ICE; I believe it is invalid as:

"A declare directive must be in the same scope as the declaration of any var
that appears in the data clauses of the directive."


void
f_data (void)
{
  int B[10];
#pragma acc data
  {
# pragma acc declare copy(B)
    for (int i = 0; i < 10; i++)
      B[i] = -i;
  }
}

In gimplify_adjust_omp_clauses_1, flags = n->value == 1 (= GOVD_SEEN) and
gimplify_omp_ctxp->region_type == ORT_ACC_DATA. – As the value is seen but
nothing else matches, one runs into gcc_unreachable (in line 10123).

EXPECTED:
(a) no ICE :-)
(b) an error as the scope is different!

 * * *

Actually, I expect such an error for 'declare' in general (for C/C++/Fortran).

Reply via email to