Miguel Murillo wrote:
>
> Dear fortran-90-mailers,
>
> I use nag-f90 in Linux and xlf90 in AIX.
> My piece of code is crazy!.
>
> I have a type FIELD, and there is a real(:,:,:) into FIELD.
> I guess make operations between FIELD, real0 (ej, 1.2),
> real3( matrix M[i,j,k])
>
> TYPE FIELD
> real(DP), pointer :: val(:,:,:) ! == real3 "virtualment"
> integer :: x1,x2, y1,y2, z1,z2
> END TYPE FIELD
>
> I guess overload operator: +,-,*,/
>
> F=FIELD, R3=Matrix(:,:,:), R0=real
>
> op | F_a | R3_b | R0_b
> .......................................................................
> F_b | Sum_F_R3(F_a, F_b % val) | |
> R3_b | Sum_F_R3(F_a, R3_b) | |
> R0_b | Sum_F_R0 | |
>
> But there are different output for:
>
> Sum_F_R3 and Sum_F_F
> Why?
>
> Thanks in advance!
>
The problem is that an assumed-shape array is just that. It does not
assume the lower bound. If you run the Nag compiler with -C you get:
Subscript 1 of IREAL2 (value 0) is out of range (1:4)
Program terminated by fatal error
Abort
John Reid.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|