public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98014] New: [Fortran OpenACC] Empty '!$acc' continuation line rejected
@ 2020-11-26 11:20 tschwinge at gcc dot gnu.org
  2021-02-14 18:02 ` [Bug fortran/98014] " dominiq at lps dot ens.fr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-11-26 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98014
           Summary: [Fortran OpenACC] Empty '!$acc' continuation line
                    rejected
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: openacc
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: burnus at gcc dot gnu.org, jakub at gcc dot gnu.org
  Target Milestone: ---

A while ago, I noticed that given an empty '!$acc' continuation line:

    !$acc parallel &
    !$acc   vector_length (1) &
    !$acc ! { dg-warning "using vector_length \\(32\\), ignoring 1" "" { target
openacc_nvidia_accel_selected } }

..., GCC doesn't like that:

    [...]: Error: Failed to match clause at (1)

If I remember correctly (haven't verified now), same thing if placing a
continuation '&' after the sentinel '!$acc'.

If I remember correctly (haven't verified now), we do accept all this for the
corresponding OpenMP constructs, and it is legal for OpenACC and OpenMP.


Is that maybe related to PR98011 "[OpenACC] 'gcc/fortran/scanner.c:load_line'
should consider 'flag_openacc' in addition to 'flag_openmp' (and vice
versa?)?", or PR98012 "[OpenACC] 'gcc/fortran/scanner.c:include_line' should
consider 'flag_openacc' in addition to 'flag_openmp'?".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/98014] [Fortran OpenACC] Empty '!$acc' continuation line rejected
  2020-11-26 11:20 [Bug fortran/98014] New: [Fortran OpenACC] Empty '!$acc' continuation line rejected tschwinge at gcc dot gnu.org
@ 2021-02-14 18:02 ` dominiq at lps dot ens.fr
  2021-02-15 10:25 ` jakub at gcc dot gnu.org
  2021-02-15 12:08 ` [Bug fortran/98014] [Fortran][OpenACC][OpenMP] Empty '!$acc'/'!$omp' " burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-02-14 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-02-14
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/98014] [Fortran OpenACC] Empty '!$acc' continuation line rejected
  2020-11-26 11:20 [Bug fortran/98014] New: [Fortran OpenACC] Empty '!$acc' continuation line rejected tschwinge at gcc dot gnu.org
  2021-02-14 18:02 ` [Bug fortran/98014] " dominiq at lps dot ens.fr
@ 2021-02-15 10:25 ` jakub at gcc dot gnu.org
  2021-02-15 12:08 ` [Bug fortran/98014] [Fortran][OpenACC][OpenMP] Empty '!$acc'/'!$omp' " burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-15 10:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
!$omp parallel &
!$omp num_threads(4) &
!$omp !comment

!$omp end parallel
end

is also rejected.  And in

!$omp parallel &
!$omp num_threads(4) &
!$omp&!comment

!$omp end parallel
end

we treat that !$omp& as the last continuation line and accept it, but as the &
is the last non-blank character before comment, shouldn't that mean a
continuation is required?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/98014] [Fortran][OpenACC][OpenMP] Empty '!$acc'/'!$omp' continuation line rejected
  2020-11-26 11:20 [Bug fortran/98014] New: [Fortran OpenACC] Empty '!$acc' continuation line rejected tschwinge at gcc dot gnu.org
  2021-02-14 18:02 ` [Bug fortran/98014] " dominiq at lps dot ens.fr
  2021-02-15 10:25 ` jakub at gcc dot gnu.org
@ 2021-02-15 12:08 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-02-15 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[Fortran OpenACC] Empty     |[Fortran][OpenACC][OpenMP]
                   |'!$acc' continuation line   |Empty '!$acc'/'!$omp'
                   |rejected                    |continuation line rejected
           Keywords|                            |openmp

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The following compiles here:

    !$acc parallel &
    !$acc   vector_length (1) &
    !$acc& ! { dg-warning }
    !$acc end parallel
end

If I remove the '&' after '!$acc', I get the error:

    2 |     !$acc   vector_length (1) &
      |                               1
Error: Failed to match clause at (1)

Same with OpenMP.

 * * *

I think there is a bug in gfortran to not accept the first version – and not to
reject the second version which should be invalid for the reasons given below.

 * * *

In any case, I believe this is an omission in the OpenACC and OpenMP specs
which does not tell how to understand that line. Namely, the following is
ambiguous:

    !$omp parallel &
    !$omp &
    !$omp if(.false.)
vs.
    !$omp parallel &
    !$omp &
    !$omp do

Is the 'omp &' line the last line of the directive? Of just in the middle of a
three-line directive?

For Fortran itself, a single '&' is invalid in free from for the same reasons.
→ "No line shall contain a single “&” as the only nonblank character or as the
only nonblank character before an “!” that initiates a comment." (F2018,
6.3.2.4 Free form statement continuation).

 * * *

On the specification side, I have opened a ticked
* for OpenACC, Issue 353
* for OpenMP,  Issue 2668.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-15 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 11:20 [Bug fortran/98014] New: [Fortran OpenACC] Empty '!$acc' continuation line rejected tschwinge at gcc dot gnu.org
2021-02-14 18:02 ` [Bug fortran/98014] " dominiq at lps dot ens.fr
2021-02-15 10:25 ` jakub at gcc dot gnu.org
2021-02-15 12:08 ` [Bug fortran/98014] [Fortran][OpenACC][OpenMP] Empty '!$acc'/'!$omp' " burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).