danieljprice / phantom

Phantom Smoothed Particle Hydrodynamics and Magnetohydrodynamics code
https://phantomsph.github.io
Other
103 stars 223 forks source link

Error: Function ‘findloc’ at (1) has no IMPLICIT type #567

Closed moverton000 closed 2 months ago

moverton000 commented 2 months ago

I had an issue compiling the phantomsetup. Error log below. What can I do?


Compiling in PARALLEL (OpenMP)
Preprocessor flags are -DISOTHERMAL -DDISC_VISCOSITY -DIND_TIMESTEPS
Fortran flags are -O3 -Wall -Wno-unused-dummy-argument -frecord-marker=4 -g -finline-functions-called-once -finline-limit=1500 -funroll-loops -ftree-vectorize -std=f2008 -fall-intrinsics -fPIC -fopenmp -fdefault-real-8 -fdefault-double-8
gfortran -c -O3 -Wall -Wno-unused-dummy-argument -frecord-marker=4 -g -finline-functions-called-once -finline-limit=1500 -funroll-loops -ftree-vectorize -std=f2008 -fall-intrinsics -fPIC -fopenmp -fdefault-real-8 -fdefault-double-8 ../src/setup/set_hierarchical_utils.f90 -o set_hierarchical_utils.o
../src/setup/set_hierarchical_utils.f90:496:9:

  index = findloc(int(data(:,2)), hier_int, 1)
         1
Error: Function ‘findloc’ at (1) has no IMPLICIT type
../src/setup/set_hierarchical_utils.f90:444:18:

  index = int(data(findloc(int(data(:,2)), hier_int, 1),1))
                  1
Error: Function ‘findloc’ at (1) has no IMPLICIT type
../src/setup/set_hierarchical_utils.f90:406:21:

     accr1 = hs%sinks(findloc(hs%labels%sink,trim(adjustl(hl_temp))//'1', 1))%accr
                     1
Error: Function ‘findloc’ at (1) has no IMPLICIT type
../src/setup/set_hierarchical_utils.f90:412:21:

     accr2 = hs%sinks(findloc(hs%labels%sink,trim(adjustl(hl_temp))//'2', 1))%accr
                     1
Error: Function ‘findloc’ at (1) has no IMPLICIT type
../src/setup/set_hierarchical_utils.f90:417:12:

  hl_index = findloc(hs%labels%hl, trim(adjustl(hl_temp)), 1)
            1
Error: Function ‘findloc’ at (1) has no IMPLICIT type
make[2]: *** [set_hierarchical_utils.o] Error 1
make[2]: Leaving directory `/home/moverton/phantom/build'
make[1]: *** [setup] Error 2```
moverton000 commented 2 months ago

I found a solution. Seemed to be related to an old version of gfortran.

Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/share/apps/gnu/gcc-6.4.0/libexec/gcc/x86_64-pc-linux-gnu/6.4.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-6.4.0/configure --prefix=/share/apps/gnu/gcc-6.4.0 --disable-multilib
Thread model: posix
gcc version 6.4.0 (GCC)

My solution was module load gcc/12.2.0

danieljprice commented 2 months ago

See comments on #532 this also causes a problem with the aocc compiler. The findloc command is a Fortran 2008 feature so only implemented in recent compiler versions...