[Bug fortran/84119] New: Type parameter inquiry for PDT returns array instead of scalar
neil.n.carlson at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jan 30 06:35:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84119
Bug ID: 84119
Summary: Type parameter inquiry for PDT returns array instead
of scalar
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: neil.n.carlson at gmail dot com
Target Milestone: ---
There seems to be a misconception in the implementation of PDT that the type
parameters are (in part) just regular components of the type, so that for
type foo(a)
integer, len :: a
end type
type(foo(a)) :: array(9)
the type inquiry array%a should give a rank-1 array of size 9. This is
incorrect. Type parameters are not components of the type. The F08 standard
clearly distinguishes between type parameter definition statements and
component definition statements. See R425, R431, R435, and in particular see
Note 6.7 which says "It [array%a, for example] is scalar even if designator is
an array."
Here's a test case that should pass. GFortran will bail on both stop lines.
type :: vector(dim,kind)
integer, len :: dim
integer, kind :: kind
end type
type(vector(3,1)) :: a(10)
if (size(shape(a%dim)) /= 0) stop 1
if (size(shape(a%kind)) /= 0) stop 2
end
More information about the Gcc-bugs
mailing list