Hello,
I have some Fortran code that compiles with the gfortran, Cray, Intel and IBM compilers but not with PGI (v. 15.1).
I have an interface to some logging routines:
interface model_write_log
module procedure write_log_a, write_log_ir, &
write_log_i, write_log_r
end interface
subroutine write_log_r(fmtstr, fvar)
use iso_fortran_env, only : output_unit ! access computing environment
implicit none
character(len=*), intent(in) :: fmtstr
real(wp), intent(in) :: fvar
and some code that attempts to call the logging routine:
real(wp) :: chksum
character(len=30) :: log_fmt
...
chksum = 10.4
write(log_fmt, "((A))") "('ua checksum = ',E16.8)"
call model_write_log(log_fmt, chksum)
I compile with -O3 only and get the error:
pgf90 -O3 -I../api_v1.0 -c nemolite2d.f90
PGF90-S-0155-Ambiguous interfaces for generic procedure model_write_log (nemolite2d.f90: 109)
Am I missing something here or is this a problem with the compiler?
Many thanks,
Andy.
Hi Andy,
Given it works with the other compilers, it’s more likely that we’re doing something wrong. Though I can’t tell without a reproducing example.
Can you either post or send to PGI Customer Service (trs@pgroup.com ) an example we can use to diagnose the problem?
Thanks,
Mat
Hi Matt,
I’ve sent in a test case to the email address you supplied. In generating this case I’ve realised that I have duplicated the code for the routine in question (model_write_log) in two separate modules. However, because I’m using the ‘only’ qualifier when I ‘use’ different routines from those modules there shouldn’t be any ambiguity.
Thanks,
Andy.
tull
August 26, 2015, 8:50pm
4
Andrew,
The example fails with 15.4 and 15.6, but appears fixed in the current 15.7 release. I can see several TPRs that were resolved, involved in making this work.
15.7
% make
pgf90 -I./ -c kind_params_mod.f90
pgf90 -I./ -c gocean_mod.F90
pgf90 -I./ -c gocean2d_io_mod.f90
pgf90 -I./ -c nemolite2d.f90
pgf90 -o go2d.exe nemolite2d.o kind_params_mod.o gocean_mod.o gocean2d_io_mod.o
danger4% go2d.exe
ua checksum = 0.10400000E+02
va checksum = 0.10400000E+02
Simulation finished!!
15.6
pgf90 -I./ -c kind_params_mod.f90
pgf90 -I./ -c gocean_mod.F90
pgf90 -I./ -c gocean2d_io_mod.f90
pgf90 -I./ -c nemolite2d.f90
PGF90-S-0155-Ambiguous interfaces for generic procedure model_write_log (nemolite2d.f90: 16)
PGF90-S-0155-Ambiguous interfaces for generic procedure model_write_log (nemolite2d.f90: 18)
0 inform, 0 warnings, 2 severes, 0 fatal for gocean2d
make: *** [nemolite2d.o] Error 2
gfortran
% gfortran -I./ -c kind_params_mod.f90
% gfortran -I./ -c gocean_mod.F90
% gfortran -I./ -c gocean2d_io_mod.f90
% gfortran -I./ -c nemolite2d.f90
% gfortran -o go2d_gfort nemolite2d.o kind_params_mod.o gocean_mod.o gocean2d_io_mod.o
% go2d_gfort
ua checksum = 0.10400000E+02
va checksum = 0.10400000E+02
Simulation finished!!
regards,
dave