certik / fortran-utils

Various utilities for Fortran programs
MIT License
209 stars 68 forks source link

Out of bounds error in zunk1 (gfortran-9) #31

Open ivan-pi opened 4 years ago

ivan-pi commented 4 years ago

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.

certik commented 4 years ago

@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.

ivan-pi commented 4 years ago

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.