Assumed arrays

Assumed arrays

The following obviously wrong program can be compiled with intel fortran compiler 13.1.3 with no error.

What compile option would detect it at compile time or run time ? We tried -check all and -warn interfaces,nouncalled -fpp -gen-interface -g -traceback -check uninit -check bounds -check pointers with no success. On the good side, valgrind detects the error. But valgrind also find many false problems with fortran programs.

In the case of an explicit-shape array dummy argument, we don't pass any bounds information. If the compiler can see the bounds of both arrays, it can complain, but in this case the bounds of the passed array are not known until run-time. There are some compilers that pass extra bounds information but this can cause calling compatibility issues.

We do catch the more common case of passing an array declared, say, (2) to one declared (10).