Kim,
Your code looks perfectly reasonable. I suspect you may have
discovered a bug in the MIPSpro compiler. If this is not the case you
have discovered a bug in the standard (if one is allowed to say a
standard can have bugs?). Either way, thank you for alerting us to
your discovery.
I tried your test on the Lahey LF90 and Digital Fortran 90 compilers
and both passed.
> Date: Mon, 23 Feb 1998 17:00:19 -0400 (EDT)
> Subject: Why not second time?
> From: Seong Gon Kim <[log in to unmask]>
> To: [log in to unmask]
> Cc: [log in to unmask] (Seong Gon Kim)
> Reply-to: Seong Gon Kim <[log in to unmask]>
> Dear Fortran 90 lovers/experts;
>
> I have encountered very peculiar (at least for me) error this morning and was
> able to reproduce it in smaller test program.
> Can any of you help me to find what am doing incorrectly?
>
> ==================== test.f90 ====================
> program main
>
> character (len = 3), dimension (3) :: table
> integer :: indx
>
> table(1) = "CAR"
> table(2) = "DLV"
> table(3) = "RLV"
>
> write (*,*) "%main: SIZE(table) = ", SIZE(table)
> do indx = 1, SIZE(table)
> write(*,*) indx," [",TRIM(table(indx)),"]"
> end do
>
> call sub1 (table)
>
> contains
>
> subroutine sub1 (table)
>
> character (len = *), dimension (:), intent (in) :: table
> integer :: indx
>
> write (*,*) "%sub1: SIZE(table) = ", SIZE(table)
> do indx = 1, SIZE(table)
> write(*,*) indx," [",TRIM(table(indx)),"]"
> end do
>
> call sub2 (table)
>
> end subroutine sub1
>
> subroutine sub2 (table)
>
> character (len = *), dimension (:), intent (in) :: table
> integer :: indx
>
> write (*,*) "%sub2: SIZE(table) = ", SIZE(table)
> do indx = 1, SIZE(table)
> write(*,*) indx," [",TRIM(table(indx)),"]"
> end do
>
> end subroutine sub2
>
> end program main
>
> ==================== end of test.f90 ====================
>
> Under AIX XL fortran, it works as i expected.
>
> % test.x
> %main: SIZE(table) = 3
> 1 [CAR]
> 2 [DLV]
> 3 [RLV]
> %sub1: SIZE(table) = 3
> 1 [CAR]
> 2 [DLV]
> 3 [RLV]
> %sub2: SIZE(table) = 3
> 1 [CAR]
> 2 [DLV]
> 3 [RLV]
>
> However, under MIPSpro Fortran 90 (SGI), it gives me something I did not
> expected.
>
> % text.x
> %main: SIZE(table) = 3
> 1 [CAR]
> 2 [DLV]
> 3 [RLV]
> %sub1: SIZE(table) = 3
> 1 [CAR]
> 2 [DLV]
> 3 [RLV]
> %sub2: SIZE(table) = 3
> 1 []
> 2 []
> 3 []
>
> My question is, which compiler is correct in terms of standard? What am I doing
> wrong here? How can I make this program work for SGI?
>
> Thank you very much in advance.
>
> ------------------------------------------------------------------------------
> Seong-Gon Kim, Ph.D. (703) 866-9584 [Home]
> Code 6690 (202) 404-4419 [Work]
> Complex Systems Theory Branch (202) 404-7546 [Fax]
> Naval Research Laboratory [log in to unmask] [email]
> Washington, DC 20375-5320 http://www.pa.msu.edu/~kimsg/ [www]
>
Regards,
David.
----------------------------------------------------------
David Vowles
Research Officer
Department of Electrical and Electronic Engineering
The University of Adelaide
Australia 5005
Voice: +61 8 8303 5416
Fax: +61 8 8303 4360
Email: [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|