public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102956] New: [PDT] KIND and LEN type parameters are mutually exclusive
@ 2021-10-26 19:19 anlauf at gcc dot gnu.org
  2021-10-26 19:41 ` [Bug fortran/102956] " anlauf at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-26 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102956
           Summary: [PDT] KIND and LEN type parameters are mutually
                    exclusive
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

F2018: 7.5.3.1  Type parameter definition statement

R732  type-param-def-stmt is
      integer-type-spec, type-param-attr-spec :: type-param-decl-list

R734  type-param-attr-spec  is KIND or LEN

(3) The type-param-attr-spec explicitly specifies whether a type parameter is a
kind parameter or a length parameter.

Thus the KIND and LEN attributes are mutually exclusive.

The follwowing should be rejected:

  type :: bad_pdt (k,l)               ! { dg-error "does not have a component"
}
     integer, kind, len      :: k = 1 ! { dg-error "attribute conflicts with" }
     integer, len, kind      :: l = 1 ! { dg-error "attribute conflicts with" }
     character(kind=k,len=l) :: c     ! { dg-error "has not been declared" }
  end type bad_pdt

which is achieved by the trivial patch:

diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 2c4acd5abe1..c77f3f84962 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -720,6 +720,7 @@ gfc_check_conflict (symbol_attribute *attr, const char
*name, locus *where)
   conf (pdt_len, pointer)
   conf (pdt_len, dimension)
   conf (pdt_len, codimension)
+  conf (pdt_len, pdt_kind)

   if (attr->access == ACCESS_PRIVATE)
     {

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

* [Bug fortran/102956] [PDT] KIND and LEN type parameters are mutually exclusive
  2021-10-26 19:19 [Bug fortran/102956] New: [PDT] KIND and LEN type parameters are mutually exclusive anlauf at gcc dot gnu.org
@ 2021-10-26 19:41 ` anlauf at gcc dot gnu.org
  2021-10-26 20:15 ` cvs-commit at gcc dot gnu.org
  2021-10-26 20:16 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-26 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-10-26
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-October/056820.html

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

* [Bug fortran/102956] [PDT] KIND and LEN type parameters are mutually exclusive
  2021-10-26 19:19 [Bug fortran/102956] New: [PDT] KIND and LEN type parameters are mutually exclusive anlauf at gcc dot gnu.org
  2021-10-26 19:41 ` [Bug fortran/102956] " anlauf at gcc dot gnu.org
@ 2021-10-26 20:15 ` cvs-commit at gcc dot gnu.org
  2021-10-26 20:16 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-26 20:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:662f64a1f9e2de65982e4d895b3afe72cbf581ba

commit r12-4722-g662f64a1f9e2de65982e4d895b3afe72cbf581ba
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Oct 26 22:14:19 2021 +0200

    Fortran: [PDT] KIND and LEN type parameters are mutually exclusive

    gcc/fortran/ChangeLog:

            PR fortran/102956
            * symbol.c (gfc_check_conflict): Add conflict check for PDT KIND
            and LEN type parameters.

    gcc/testsuite/ChangeLog:

            PR fortran/102956
            * gfortran.dg/pdt_32.f03: New test.

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

* [Bug fortran/102956] [PDT] KIND and LEN type parameters are mutually exclusive
  2021-10-26 19:19 [Bug fortran/102956] New: [PDT] KIND and LEN type parameters are mutually exclusive anlauf at gcc dot gnu.org
  2021-10-26 19:41 ` [Bug fortran/102956] " anlauf at gcc dot gnu.org
  2021-10-26 20:15 ` cvs-commit at gcc dot gnu.org
@ 2021-10-26 20:16 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-26 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from anlauf at gcc dot gnu.org ---
Fixed for gcc-12.  Closing.

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

end of thread, other threads:[~2021-10-26 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 19:19 [Bug fortran/102956] New: [PDT] KIND and LEN type parameters are mutually exclusive anlauf at gcc dot gnu.org
2021-10-26 19:41 ` [Bug fortran/102956] " anlauf at gcc dot gnu.org
2021-10-26 20:15 ` cvs-commit at gcc dot gnu.org
2021-10-26 20:16 ` 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).