S Yuan wrote:
> Hi,
>
> For the following code, some complilers write out 1.0 and some write out
> 0.0 for op(1:3,1:3,1). Which one is correct, or standard conforming?
>
> First time to post a question. Thanks.
>
> S Yuan
>
> program main
> implicit none
> real :: op(3,4,2), s
>
> op=0.0
> s=1.0
>
> call adds(op(1:3,1:3,1),op(1:3,1:3,1),s)
> write(*,"(3(3f8.4,/))")op(1:3,1:3,1)
>
> stop
> contains
>
> subroutine adds(b,a,s)
> real, intent(in out) :: b(3,3),a(3,3),s
> real :: c(3,3)
> c=a+s
> b=c
> ! write(*,"(3(3f8.4,/))")b
> return
> end subroutine adds
>
> end program main
>
If the program is not standard conforming, how can either of the common
results be standard conforming? When I make this change:
real, intent(in ) :: a(3,3),s
real, intent(out) :: b(3,3)
then the compilers available to me give the same (reasonably expected)
result. I have not been able to persuade either family of compilers to
produce warnings about this situation.
|