(j3.2006) same types

Bill Long longb
Thu Nov 1 16:50:07 EDT 2007


Consider this simple program:

type x
    sequence
    integer :: i = 3
endtype
 
type (x) :: xloc,xarg
call sub(xarg)
print *, xloc
print *, xarg
contains
 
      subroutine sub(arg)
      type x
         sequence
         integer :: i = 5
      endtype
      type (x), intent(out) :: arg
      endsubroutine
end


According to the requirements in the standard, the two type X 
definitions qualify as the "same type".  And the program runs OK, printing

3
5

But, is this really intended to be standard conforming?  It seems 
counterintuitive that these two types are the same.  Was this just 
overlooked when the ability to default initialize components was 
added?   A code like this has a lot of potential for giving an inliner 
headaches.

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