fortran-utils icon indicating copy to clipboard operation
fortran-utils copied to clipboard

Out of bounds error in zunk1 (gfortran-9)

Open ivan-pi opened this issue 5 years ago • 2 comments

With gfortran-9 (gcc version 9.2.1 20191102 ) I get the following error upon compilation

~/fortran-utils/build$ make fortran_utils
[  0%] Building Fortran object src/legacy/amos/CMakeFiles/amos.dir/zunk1.f.o
/home/ipribec/TUM/fortran-utils/src/legacy/amos/zunk1.f:129:16:

   55 |       DO 70 I=1,N
      |                                                                        2
......
  129 |         IF ((YR(I-1).EQ.ZEROR).AND.(YI(I-1).EQ.ZEROI)) GO TO 70
      |                1
Error: Array reference at (1) out of bounds (0 < 1) in loop beginning at (2) [-Werror=do-subscript]

The error can be silenced by adding -Wno-error=do-subscript to the CMakeLists.txt in the src/legacy/amos folder.

ivan-pi avatar Apr 02 '20 22:04 ivan-pi

@ivan-pi great catch. I am hoping to port most of fortran-utils to stdlib. This amos is used for some stuff, we'll have to decide what to do about it. This might not be hard to fix.

certik avatar Apr 02 '20 22:04 certik

The -Wno-error=do-subscript flag is not available in older versions of gfortran (e.g. version 7.5) so this is not a solution anyways.

ivan-pi avatar Apr 02 '20 22:04 ivan-pi