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

            Bug ID: 92728
           Summary: [OpenMP][OpenACC] Common-block name clause matching
                    issues: common block needs to be defined before +
                    blank common not supported
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: openacc, openmp
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Based on the discussion at
  https://gcc.gnu.org/ml/gcc-patches/2019-11/threads.html#00717

The current clause matching code in openmp.c's gfc_match_omp_variable_list
does:

      m = gfc_match (" / %n /", n);
…
      st = gfc_find_symtree (gfc_current_ns->common_root, n);
      if (st == NULL)
        {
          gfc_error ("COMMON block /%s/ not found at %C", n);

Hence:
(1) This code requires the ordering
      common /name/ …
      !$omp … (/name/)
      !$acc … (/name/)
    while it would be (also) natural to use
      !$omp … (/name/)
      !$acc … (/name/)
      common /name/ …
    The Fortran standard usually permits this and at least part of the OpenXXX
    specs talk only about the specification section, not imposing any ordering.

* Blank commons (i.e. common blocks without a name) cannot be matched.

Regarding blank commons: neither OpenMP nor OpenACC are clear whether they are
permitted and where. – However, in some clauses, OpenMP explicitly mentions
that blank commons are not permitted, implying that they are permitted
elsewhere. (See linked emails in the thread.)

Reply via email to