| Title: | Digital Fortran |
| Notice: | Read notes 1.* for important information |
| Moderator: | QUARK::LIONEL |
| Created: | Thu Jun 01 1995 |
| Last Modified: | Fri Jun 06 1997 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 1333 |
| Total number of notes: | 6734 |
My customer has a problem to compile the following little example
program. Other compiler (NAGWare f90,xlf90) accept this code.
Any hints?
Hans-Werner
program t ! 1
type comp ! 2
integer :: a, b ! 3
end type comp ! 4
type var ! 5
type(comp), pointer :: e(:) ! 6
end type var ! 7
type(var) :: v ! 8
integer :: i, n = 2 ! 9
allocate(v%e(n)) ! 10
do i = 1, n ! 11
read(*,*) v%e(i) ! 12
end do ! 13
end program t ! 14
f90 -free -c t.f
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 1257.1 | F90 Standard says this is illegal | TLE::WHITLOCK | Stan Whitlock | Mon Apr 14 1997 10:45 | 20 |
The f90 compiler reports
f90: Error: x.f90, line 12: An object of a derived type that ultimately contains
a pointer component must not appear in an input item list. [E]
read(*,*) v%e(i) ! 12
---------------------^
This is correct behavior according to the F90 Standard but I am a little
surprised. The F90 {and F95} Standard expleicitly says {section 9.4.2,pg 124,
lines 17-18}:
If a derived type ultimately contains a pointer component, an object
of this type must not appear as an input item nor as the result of
the evaluation of an output list item.
Obviously NAG and Lahey have extended this behavior... we haven't. I'll ask
around the Fortran standards guys and implementors to see why there is this
restriction.
/Stan
| |||||