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

            Bug ID: 105501
           Summary: The statement TYPE IS without a space is accepted
           Product: gcc
           Version: 11.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chilikin.k at gmail dot com
  Target Milestone: ---

The following module

MODULE M
  TYPE T
    INTEGER I
  END TYPE
CONTAINS
  SUBROUTINE S(X)
    CLASS(T), POINTER :: X
    SELECT TYPE (X)
      TYPEIS (T)
        PRINT *, 'T'
    END SELECT
  END SUBROUTINE
END MODULE

compiles without any messages with gfortran 11.3.0:

$ gfortran -c -std=f2018 -pedantic test.f90

(there are no warnings)

However, "TYPEIS" requires one or more blank characters between "TYPE" and "IS"
in accordance with the section "Blank characters in free form" of the standard
as it is not included in the list of exceptions with optional blanks.

For comparison, the output of flang 14.0.3 is:

$ flang -c -std=f2018 test.f90
test.f90:9:12: missing space
        TYPEIS (T)
             ^
test.f90:9:7: in the context: type guard statement
        TYPEIS (T)
        ^
test.f90:8:5: in the context: SELECT TYPE construct
      SELECT TYPE (X)
      ^
test.f90:8:5: in the context: execution part construct
      SELECT TYPE (X)
      ^
test.f90:8:5: in the context: execution part
      SELECT TYPE (X)
      ^
test.f90:6:3: in the context: SUBROUTINE subprogram
    SUBROUTINE S(X)
    ^
test.f90:5:1: in the context: module subprogram part
  CONTAINS
  ^
test.f90:1:1: in the context: module
  MODULE M
  ^

Reply via email to