为何gfortran编译ESL-bundle报错,ifort与pgf90却正常?
ESL-bundle的futile模块gfortran编译问题
操作步骤
git clone https://gitlab.com/ElectronicStructureLibrary/esl-bundle/-/tree/master mkdir install && cd install #export FC=<path of gfortran> # 默认使用pgf90 ../esl-bundle/install-bundle --conditions +yaml futile | tee ./install-1.log
编译结果
使用pgf90和ifort编译可正常通过,但切换到gfortran时出现如下报错:
esl-bundle/checkouts/futile-1.8/dicts/f_precisions.f90:95:29: 95 | k=int(f_loc(a(2))-f_loc(a(1))) | 1 Error: Type mismatch in argument ‘routine’ at (1); passed REAL(4) to UNKNOWN
相关代码片段
类型大小计算函数sizeof_r
function sizeof_r(av) result(k) !function documented here implicit none real(f_simple), intent(in) :: av real(f_simple), dimension(2) :: a integer :: k a(1)=av k = int(f_loc(a(2)) - f_loc(a(1))) end function sizeof_r
f_loc函数定义
!> Function which identifies the address of the scalar object !! associated to a unknown quantity function f_loc(routine) use f_precisions, only: f_address implicit none external :: routine !< Object integer(f_address) :: f_loc !< Address of the object routine call getlongaddress(routine,f_loc) end function f_loc
问题
报错原因看起来是f_loc的参数routine没有明确类型定义。想请教:
- 为什么pgf90和ifort可以正常处理这段代码,但gfortran不行?
- 有没有办法通过调整gfortran的编译器参数来修复这个问题,不需要修改代码?(注:该软件包比较老旧,且在众多科学软件中广泛使用,因此不想调试或重写任何代码。)
内容的提问来源于stack exchange,提问作者Enzo
相关产品推荐
相关产品推荐

