(j3.2006) more on J32031 equivalence of circular types
Van Snyder
Van.Snyder
Thu Aug 21 19:24:04 EDT 2008
On Thu, 2008-08-21 at 17:50 -0500, Bill Long wrote:
> g95: Gave this curious error message:
>
> In file ./test.f90:7
>
> TYPE(T) :: A
> 1
> Error: Module variable 'a' at (1) with a default initialization must
> have the SAVE attribute
According to the fourth constraint after R1106 in Subclause 11.3 of
97-007r2 (the F95 standard), this behavior is required.
Constraint: If an object of a type for which
component-initialization is specified (R429) appears in the
specification-part of a module and does not have the ALLOCATABLE
or POINTER attribute, the object shall have the SAVE
attribute.
After specifying SAVVE, Lahey/Fujitsu lf95 v6.20d for Linux and NAG f95
v5.1(517) for Linux compile the sample program without complaint.
Without the modification, both announce essentially the same error as
g95.
==========================================================================
To recall, the program is:
MODULE FOO
TYPE T
SEQUENCE
TYPE(T), POINTER :: NEXT => NULL()
END TYPE T
TYPE(T), save :: A
END MODULE FOO
MODULE BAR
TYPE T
SEQUENCE
TYPE(T), POINTER :: NEXT => NULL()
END TYPE T
TYPE(T), save :: B
END MODULE BAR
USE FOO, ONLY : A
USE BAR, ONLY : B
! Do A and B have the same type ?
A = B
END
More information about the J3
mailing list