public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105501] New: The statement TYPE IS without a space is accepted
@ 2022-05-06  7:31 chilikin.k at gmail dot com
  2022-05-06 20:34 ` [Bug fortran/105501] " anlauf at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: chilikin.k at gmail dot com @ 2022-05-06  7:31 UTC (permalink / raw)
  To: gcc-bugs

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
  ^

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

* [Bug fortran/105501] The statement TYPE IS without a space is accepted
  2022-05-06  7:31 [Bug fortran/105501] New: The statement TYPE IS without a space is accepted chilikin.k at gmail dot com
@ 2022-05-06 20:34 ` anlauf at gcc dot gnu.org
  2022-05-06 20:51 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-05-06 20:34 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-05-06
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.  Intel and NAG reject the testcase, too.

In F2018, the mentioned table is:

Table 6.2: Adjacent keywords where separating blanks are optional

In does neither mention TYPE IS nor CLASS IS.
However, CLASSIS (CLASS IS w/o blanks) is properly rejected.

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

* [Bug fortran/105501] The statement TYPE IS without a space is accepted
  2022-05-06  7:31 [Bug fortran/105501] New: The statement TYPE IS without a space is accepted chilikin.k at gmail dot com
  2022-05-06 20:34 ` [Bug fortran/105501] " anlauf at gcc dot gnu.org
@ 2022-05-06 20:51 ` anlauf at gcc dot gnu.org
  2022-05-08 20:18 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-05-06 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Untested patch:

diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc
index e6e915d2a5e..f1fa7feb5a9 100644
--- a/gcc/fortran/parse.cc
+++ b/gcc/fortran/parse.cc
@@ -571,7 +571,7 @@ decode_statement (void)
     case 't':
       match ("target", gfc_match_target, ST_ATTR_DECL);
       match ("type", gfc_match_derived_decl, ST_DERIVED_DECL);
-      match ("type is", gfc_match_type_is, ST_TYPE_IS);
+      match ("type% is", gfc_match_type_is, ST_TYPE_IS);
       break;

     case 'u':

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

* [Bug fortran/105501] The statement TYPE IS without a space is accepted
  2022-05-06  7:31 [Bug fortran/105501] New: The statement TYPE IS without a space is accepted chilikin.k at gmail dot com
  2022-05-06 20:34 ` [Bug fortran/105501] " anlauf at gcc dot gnu.org
  2022-05-06 20:51 ` anlauf at gcc dot gnu.org
@ 2022-05-08 20:18 ` anlauf at gcc dot gnu.org
  2022-05-09 19:36 ` cvs-commit at gcc dot gnu.org
  2022-05-09 19:38 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-05-08 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Extended patch: https://gcc.gnu.org/pipermail/fortran/2022-May/057839.html

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

* [Bug fortran/105501] The statement TYPE IS without a space is accepted
  2022-05-06  7:31 [Bug fortran/105501] New: The statement TYPE IS without a space is accepted chilikin.k at gmail dot com
                   ` (2 preceding siblings ...)
  2022-05-08 20:18 ` anlauf at gcc dot gnu.org
@ 2022-05-09 19:36 ` cvs-commit at gcc dot gnu.org
  2022-05-09 19:38 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-09 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:8c97f7fd2382aa77f36567207e949447db90a1fb

commit r13-216-g8c97f7fd2382aa77f36567207e949447db90a1fb
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sun May 8 22:04:27 2022 +0200

    Fortran: check for non-optional spaces between adjacent keywords

    In free format, spaces between adjacent keywords are not optional except
    when a combination is explicitly listed (e.g. F2018: table 6.2).  The
    following combinations thus require separating blanks: CHANGE TEAM,
    ERROR STOP, EVENT POST, EVENT WAIT, FAIL IMAGE, FORM TEAM, SELECT RANK,
    SYNC ALL, SYNC IMAGES, SYNC MEMORY, SYNC TEAM, TYPE IS.

    gcc/fortran/ChangeLog:

            PR fortran/105501
            * match.cc (gfc_match_if): Adjust patterns used for matching.
            (gfc_match_select_rank): Likewise.
            * parse.cc (decode_statement): Likewise.

    gcc/testsuite/ChangeLog:

            PR fortran/105501
            * gfortran.dg/pr105501.f90: New test.

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

* [Bug fortran/105501] The statement TYPE IS without a space is accepted
  2022-05-06  7:31 [Bug fortran/105501] New: The statement TYPE IS without a space is accepted chilikin.k at gmail dot com
                   ` (3 preceding siblings ...)
  2022-05-09 19:36 ` cvs-commit at gcc dot gnu.org
@ 2022-05-09 19:38 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-05-09 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed for gcc-13.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2022-05-09 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  7:31 [Bug fortran/105501] New: The statement TYPE IS without a space is accepted chilikin.k at gmail dot com
2022-05-06 20:34 ` [Bug fortran/105501] " anlauf at gcc dot gnu.org
2022-05-06 20:51 ` anlauf at gcc dot gnu.org
2022-05-08 20:18 ` anlauf at gcc dot gnu.org
2022-05-09 19:36 ` cvs-commit at gcc dot gnu.org
2022-05-09 19:38 ` anlauf 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).