Silverfrost Forums

Welcome to our forums

Failure to catch array assignment with mismatched shapes

18 Apr 2019 1:49 #23531

Consider the following code, which is in error on Line-6 since the variable on the left and the expression on the right have different shapes.

program nph
implicit none
integer i,ijk,ia(1),ja(5)
!
ia = 123
ja = ia             ! Error, array shapes do not match
write(*,'(5i12)')ja
end

With /checkmate, 32-bit FTN95 V8.4 runs with no error messages and outputs

         123         123         123         123         123

The 64-bit compiler, with /checkmate, causes a run time error but the error is reported as the use of an undefined variable. Gfortran issues a clear error message at compile time:

Error: Different shape for array assignment at (1) on dimension 1 (5 and 1)
18 Apr 2019 3:13 #23532

Thank you. I have made a note of this.

12 Jul 2019 4:56 #23984

This has now been fixed for the next release of FTN95.

Please login to reply.