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

            Bug ID: 94709
           Summary: [OpenMP][OpenACC][!GCC$ attributes] No line truncation
                    warning printed for directives
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: diagnostic, openacc, openmp
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Created attachment 48333
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48333&action=edit
Draft patch – fixes the problem but now wrongly warns for some too-long
comments

Came up in PR 94690 comment 2

Namely, if an OpenMP directive gets truncated after maxlen = 132 (for free-form
source code), it is simply truncated without showing an error – and one is
surprised about the parser failure.

Expected: With free form an error, with fixed form a warning with -Wall.

The reason that this does not happen is that commented lines are silently
truncated – and this includes !$omp and !$acc directives and !GCC$ attributes.


The attached patch fixes this issue, but now causes an error for:
 a = b ! very, very long comment

This happens commonly with "! dg-error" lines (e.g.
gfortran.dg/bind_c_bool_1.f90 to pick one).

Namely:
* If the comment starts after maxlen, it is fine with the current patch.
* If the comment starts at the beginning of the line, it is also fine – the
gfc_next_char_literal function takes care of this. (Which has a complicated
check for OpenMP/OpenACC/!GCC$.)

* Only if the comment starts within the permitted range but is too long, now
  a warning/Werror is printed.

Reply via email to