Flang error in Cactus/src/util/PointerTo.F90

Create issue
Issue #2529 new
Erik Schnetter created an issue

Flang 12.0.0 (the LLVM Fortran compiler) reports an error in Cactus/src/util/PointerTo.F90. I can make the code compile when I disable the setting #define HAVE_CCTK_F_TYPE_STAR in cctk_Config.h.

1621195405.31277 Compiling /home/eschnetter/src/CarpetX/Cactus/src/util/PointerTo.F90
current_wd=`pwd` ; cd /home/eschnetter/src/CarpetX/Cactus/configs/sim-llvm/scratch ; /home/eschnetter/src/CarpetX/Cactus/view-compil
ers-llvm/bin/flang -pipe -g -march=native -fcray-pointer -ffixed-line-length-none -O3 -ffp-contract=fast -fno-math-errno -fno-rounding-math -funsafe-math-optimizations  -Wall -Wshadow -Wsurprising -I"/home/eschnetter/src/CarpetX/Cactus/view-llvm/include" -I"/home/
eschnetter/src/CarpetX/Cactus/view-llvm/include" -I"/home/eschnetter/src/CarpetX/spack/opt/spack/linux-ubuntu18.04-skylake_avx512/gc
c-10.3.0/openmpi-4.0.5-r5fts4e7cvxadfzjtlq4pjjuv7e5pcoq/include" -I"/home/eschnetter/src/CarpetX/Cactus/src" -I"/home/eschnetter/src/CarpetX/Cactus/src/include" -I"/home/eschnetter/src/CarpetX/Cactus/configs/sim-llvm/config-data" -I"/home/eschnetter/src/CarpetX/Ca
ctus/configs/sim-llvm/bindings/include" -I"/home/eschnetter/src/CarpetX/Cactus/src/include" -I"/home/eschnetter/src/CarpetX/Cactus/a
rrangements" -I"/home/eschnetter/src/CarpetX/Cactus/configs/sim-llvm/bindings/Configuration/Thorns" -I"/home/eschnetter/src/CarpetX/
Cactus/configs/sim-llvm/bindings/include/Cactus" -I"/home/eschnetter/src/CarpetX/Cactus/src/util" -I"/home/eschnetter/src/CarpetX/Cactus/configs/sim-llvm/bindings/include/Cactus" -c -o $current_wd/PointerTo.F90.o $current_wd/PointerTo.f90
/home/eschnetter/src/CarpetX/Cactus/configs/sim-llvm/build/Cactus/util/PointerTo.f90:409:22: error: Assumed type argument requires a
n explicit interface
    address = transfer(c_loc(var), address)
                       ^^^^^^^^^^

Comments (6)

  1. Roland Haas

    Can you supply the file configs/sim-llvm/config-data/config.log, please?

    The configure test there uses:

          subroutine foo(a)
            use iso_c_binding, only: c_loc,c_intptr_t
            implicit none
            type(*),dimension(..),target :: a
            integer(kind=kind(c_intptr_t)) :: b
            b = transfer(c_loc(a), b)
          end subroutine
    
          program main
    
          end
    

    which is (almost other than the c_intptr_t) the same code as inf PointerTo.F90:

    CCTK_POINTER function CCTK_PointerTo(var)
      use iso_c_binding, only: c_loc
      implicit none
    
      type(*), dimension(..), TARGET :: var
      CCTK_POINTER :: address
    
      address = transfer(c_loc(var), address)
      CCTK_PointerTo = address
    end function
    

    so I would have expected some configure test failing and the define not to be set.

  2. Erik Schnetter reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  3. Erik Schnetter reporter

    These are the relevant lines in config.log:

    configure:2105: checking whether the Fortran compiler (/home/eschnetter/src/CarpetX/Cactus/view-compilers-llvm/bin/flang  ) supports TYPE(*) for CCTK_PointerTo
    configure:2130: /home/eschnetter/src/CarpetX/Cactus/view-compilers-llvm/bin/flang -c -pipe -g -march=native -fcray-pointer -ffixed-line-length-none conftest.f 1>&5
    conftest.f:7:22: error: Assumed type argument requires an explicit interface
              b = transfer(c_loc(a), b)
                           ^^^^^^^^
    /home/eschnetter/src/CarpetX/Cactus/view-compilers-llvm/bin/f18: Semantic errors in conftest.f
    flang: in /home/eschnetter/src/CarpetX/Cactus/configs/sim-llvm-debug/config-data, f18 failed with exit status 0: /home/eschnetter/src/CarpetX/Cactus/view-compilers-llvm/bin/f18 -module-suffix .f18.mod -intrinsic-module-directory /home/eschnetter/src/CarpetX/Cactus/view-compilers-llvm/include/flang -c -pipe -g -march=native -fcray-pointer -ffixed-line-length-none conftest.f
    

    That is, the error is reported, but somehow doesn’t make it back to the configure script.

  4. Roland Haas

    uh f18 failed with exit status 0 is not very great behaviour by flang. Looks like a bug in the f18 compiler to me, in that it does not set a non-zero exit code when finding this particular error.

  5. Log in to comment