Hi,
I am trying to compile a fortran code which interfaces with a C library and I get the following error.
$ pgf90 -module . -O0 -Minform=inform -c errhandler.f90 -o errhandler.o
PGF90-F-0000-Internal compiler error. gen_llvm_expr(): no incoming ili 0 (errhandler.f90: 73)
PGF90/power Linux 16.10-0: compilation aborted
I am using pgf90 version 16.10 on a OpenPower machine.
pgf90 -V
pgf90 16.10-0 linuxpower target on Linuxpower
The Portland Group - PGI Compilers and Tools
Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
note that I am able to compile this code with gfortran 4.8.4. In the code below, I isolated the part of the modules which prevent the compilation of the whole file. The actual module is 421 lines long.
I noticed that if I remove the function calls to PC_errhandler_f, the code compiles.
Can you help me? thank you,
Abel
Here is the source code of the modules I am trying to compile:
module pc_types
USE iso_C_binding
IMPLICIT NONE
TYPE, bind(C) :: PC_errhandler_t
TYPE(C_FUNPTR) :: func
TYPE(C_PTR) :: context
END TYPE PC_errhandler_t
end module pc_types
MODULE pc
USE iso_C_binding
USE pc_types
IMPLICIT NONE
! Error handlers
TYPE(PC_errhandler_t), BIND(C, NAME="PC_ASSERT_HANDLER") :: PC_ASSERT_HANDLER
TYPE(PC_errhandler_t), BIND(C, NAME="PC_NULL_HANDLER") :: PC_NULL_HANDLER
INTERFACE
TYPE(PC_errhandler_t) FUNCTION PC_errhandler_f(handler) &
bind(C, name="PC_errhandler")
USE iso_C_binding
USE pc_types
TYPE(PC_errhandler_t), VALUE :: handler
END FUNCTION PC_errhandler_f
END INTERFACE
CONTAINS
!==================================================================
SUBROUTINE PC_errhandler(new_handler, old_handler)
TYPE(PC_errhandler_t), INTENT(IN) :: new_handler
TYPE(PC_errhandler_t), INTENT(OUT), OPTIONAL :: old_handler
TYPE(PC_errhandler_t) :: tmp_handler
IF (PRESENT(old_handler)) THEN
old_handler = PC_errhandler_f(new_handler)
ELSE
tmp_handler = PC_errhandler_f(new_handler)
END IF
END SUBROUTINE PC_errhandler
!==================================================================
END MODULE pc
!======================================================================