(j3.2006) more on J32031 equivalence of circular types

Bill Long longb
Thu Aug 21 18:50:47 EDT 2008



Michael Ingrassia wrote:
>
> As for Bill's question (is this only a theoretical concern), I ran the Sun
> compiler on the sample program and we accept it without errors, which is
> evidence that we treat A's type and B's type as the same.  Maybe others
> want to check their compilers.
>
>   
To recall, the program is:

        MODULE FOO
        TYPE T
           SEQUENCE
           TYPE(T), POINTER :: NEXT => NULL()
        END TYPE T
        TYPE(T) :: A
        END MODULE FOO

        MODULE BAR
        TYPE T
           SEQUENCE
           TYPE(T), POINTER :: NEXT => NULL()
        END TYPE T
        TYPE(T) :: B
        END MODULE BAR

        USE FOO, ONLY : A
        USE BAR, ONLY : B

        ! Do A and B have the same type ?
        A = B
        END


Here are the results from the compilers I have available:

Cray: clean compile - same as SUN.

Pathscale: clean compile as well.

PGI: Fatal - terminated by signal 11.  [compiler aborted]

gfortran: Internal error: Segmentation fault (program f951)  [compiler 
aborted]

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
 
I assume Toon and Andy read this list, so will deal with the gfortran 
and g95 results.  (Note: I may not have the latest version of either.)  
I do have the latest version of PGI, and will file a bug report with them.

The results are more interesting than I expected.

Cheers,
Bill



-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list