This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/82978] [PDT] [F2003] Paramaterized Derived Type LEN parameters take the latest value per-kind


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-11-14
             Blocks|                            |82173
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The test shows two problems with PDT:

(1) The kind of the character is not taken into account:

Adding the line

print *, kind(w1%chr), kind(x1%chr), kind(y1%chr), kind(z1%chr)

gives

           1           1           1           1

As a consequence the KINDs 2 and 8 are not properly rejected.

(2) The length is not properly set if there is more than one character PDT with
the same kind:

implicit none

type :: pdt_t(k, l)
  integer, kind :: k
  integer, len :: l
  character(kind=k,len=l) :: chr
end type

type(pdt_t(1, 4))   :: x1
type(pdt_t(1, 5))   :: x2
type(pdt_t(1, 6))   :: x3

print *, 'exp. len      act. len'
print *, x1%l, len(x1%chr)
print *, x2%l, len(x2%chr)
print *, x3%l, len(x3%chr)

end

gives

 exp. len       act. len
           4           6
           5           6
           6           6

but I fail to see the logic:

type(pdt_t(1, 4))   :: x1
type(pdt_t(1, 6))   :: x3
type(pdt_t(1, 50))   :: x2
...
print *, x3%l, len(x3%chr)
print *, x1%l, len(x1%chr)
print *, x2%l, len(x2%chr)

gives

           6           6
           4           6
          50           6

?-(


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82173
[Bug 82173] [meta-bug] Parameterized derived type errors

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]