Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28386 Discussions

Mixed F77 and F90 code fails when incorporating the same iso_varying_string.

jr_reuter
Beginner
891 Views
When I compile things in the following order:
ifort -c iso_varying_string.f90
ifort -c mrst2004qed.f
ifort -c pdf_builtin.f90
then I get the following error message:
ifort -c pdf_builtin.f90
pdf_builtin.f90(76): warning #7319: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [CHAR]
pre_char = trim (char (mprefix))
-----------------------^
pdf_builtin.f90(76): error #6404: This name does not have a type, and must have an explicit type. [CHAR]
pre_char = trim (char (mprefix))
-----------------^
pdf_builtin.f90(76): error #6362: The data types of the argument(s) are invalid. [TRIM]
pre_char = trim (char (mprefix))
-----------------^
pdf_builtin.f90(90): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
if (mverbose) print *, "Initialized builtin PDF " // &
^
[ Aborting due to internal error. ]

When I rewrite mrst2004qed.f to Fortran 90, the code compiles. Anything fishy going on here.


I do use the newest Intel Fortran Compiler (Intel Fortran Compiler XE for applications running on IA-32, Version 12.0.1.107 Build 20101116).

Here is the code: (iso_varying_string.f90 is the standard file from http://www.fortran.com/iso_varying_string.f95)

mrst2004qed.f:
module mrst2004qed

contains

subroutine mrstqed(x,q,mode,upv,dnv,usea,dsea,str,chm,bot,
xglu,phot,prefix)

use iso_varying_string !NODEP!
implicit real*8(a-h,o-z)
type(varying_string) prefix
data xmin,xmax,qsqmin,qsqmax/1d-5,1d0,1.25d0,1d7/
integer runit, estat
q2=q*q
if(init.ne.0) goto 10
runit = 6
open(unit=runit,file=char (prefix) // '/qed6-10gridp.dat',
x status='old', iostat=estat)
close (runit)
10 continue
return
endsubroutine

subroutine mrst1(x,qsq,upv,dnv,usea,dsea,str,chm,
xbot,glu,phot)
implicit real*8(a-h,o-z)
return
endsubroutine

endmodule

end the module pdf_builtin.f90:

module pdf_builtin
use iso_varying_string, string_t => varying_string !NODEP!
use mrst2004qed
implicit none
save
private

! The available sets
integer, parameter :: nsets = 6
integer, parameter, public :: &
CTEQ6M = 1, CTEQ6D = 2, CTEQ6L = 3, CTEQ6L1 = 4, &
MRST2004QEDp = 5, MRST2004QEDn = 6

integer :: cteq6_initialized = -1
logical :: &
mrst2004qedp_initialized = .false., &
mrst2004qedn_initialized = .false.
type(string_t) :: mrst2004qedp_prefix, mrst2004qedn_prefix

! Public stuff
public :: pdf_init, pdf_get_name, pdf_evolve, &
pdf_provides_photon

contains

! Get PDF name
function pdf_get_name (pdftype) result (name)
integer, intent(in) :: pdftype
type(string_t) :: name
select case (pdftype)
case (CTEQ6M)
name = var_str ("CTEQ6M")
case (CTEQ6D)
name = var_str ("CTEQ6D")
case (CTEQ6L)
name = var_str ("CTEQ6L")
case (CTEQ6L1)
name = var_str ("CTEQ6L1")
case (MRST2004QEDp)
name = var_str ("MRST2004QEDp")
case (MRST2004QEDn)
name = var_str ("MRST2004QEDn")
end select
end function pdf_get_name

! Query whether a PDF supplies a photon distribution
function pdf_provides_photon (pdftype) result (flag)
integer, intent(in) :: pdftype
logical :: flag
select case (pdftype)
case (CTEQ6M, CTEQ6D, CTEQ6L, CTEQ6L1)
flag = .false.
case (MRST2004QEDp, MRST2004QEDn)
flag = .true.
end select
end function pdf_provides_photon

! Initialize a PDF
subroutine pdf_init (pdftype, prefix, verbose)
integer, intent(in) :: pdftype
type(string_t), intent(in), optional :: prefix
type(string_t) :: mprefix
character(len=30) :: pre_char
logical, intent(in), optional :: verbose
logical :: mverbose
if (present (prefix)) then
mprefix = prefix
else
mprefix = var_str ("")
end if
if (present (verbose)) then
mverbose = verbose
else
mverbose = .true.
end if
pre_char = trim (char (mprefix))
select case (pdftype)
case (CTEQ6M, CTEQ6D, CTEQ6L, CTEQ6L1)
if (cteq6_initialized == pdftype) return
cteq6_initialized = pdftype
case (MRST2004QEDp)
if (mrst2004qedp_initialized) return
mrst2004qedp_initialized = .true.
mrst2004qedp_prefix = prefix
case (MRST2004QEDn)
if (mrst2004qedn_initialized) return
mrst2004qedn_initialized = .true.
mrst2004qedn_prefix = prefix
end select
if (mverbose) print *, "Initialized builtin PDF " // &
char (pdf_get_name (pdftype))
end subroutine pdf_init

! Evolve PDF
subroutine pdf_evolve (pdftype, x, q, f, fphoton)
integer, intent(in) :: pdftype
real, intent(in) :: x, q
real, intent(out), optional :: f(-6:6), fphoton
real*8 :: mx, mq
real*8 :: upv, dnv, ups, dns, str, chm, bot, glu, phot
select case (pdftype)
case (CTEQ6M, CTEQ6D, CTEQ6L, CTEQ6L1)
if (cteq6_initialized < 0) &
print *, "pdf_builtin: internal: PDF set " // &
char (pdf_get_name (pdftype)) // " requested without initialization!"
mx = 0
mq = 0
case (MRST2004QEDp)
if (.not. mrst2004qedp_initialized) print *, &
"pdf_builtin: internal: PDF set MRST2004QEDp requested without " // &
"initialization!"
mx = 0
mq = 0
call mrstqed (mx, mq, 1, upv, dnv, ups, dns, str, chm, bot, glu, phot, &
mrst2004qedp_prefix)
case (MRST2004QEDn)
if (.not. mrst2004qedn_initialized) print *, &
"pdf_builtin: internal: PDF set MRST2004QEDn requested without " // &
"initialization!"
mx = 0
mq = 0
call mrstqed (mx, mq, 2, upv, dnv, ups, dns, str, chm, bot, glu, phot, &
mrst2004qedn_prefix)
end select
end subroutine pdf_evolve

end module pdf_builtin



0 Kudos
5 Replies
Kevin_D_Intel
Employee
891 Views
I see the same compilation errors and internal error withmrst2004qed.f and mrst2004qed.f90. I reported the internal error to Development (see internal tracking id below).

(Internal tracking id: DPD200164649)

(Resolution Update on 05/17/2011): This defect is fixed in the Intel Fortran Composer XE 2011 Update 4 (2011.4.191 - Linux)

Can you double check the compile when using Fortran 90?

In converting mrst2004qed.f to .f90, all I did was join continued lines. Did you do more?

Here's the .f90 compile:

$ifort -c -V iso_varying_string.f90
Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.1.107 Build 20101116
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
Intel Fortran 12.0-1230

$ifort -c mrst2004qed.f90

$ifort -c pdf_builtin.f90
pdf_builtin.f90(76): warning #7319: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [CHAR]
pre_char = trim (char (mprefix))
-----------------------^
pdf_builtin.f90(76): error #6404: This name does not have a type, and must have an explicit type. [CHAR]
pre_char = trim (char (mprefix))
-----------------^
pdf_builtin.f90(76): error #6362: The data types of the argument(s) are invalid. [TRIM]
pre_char = trim (char (mprefix))
-----------------^
pdf_builtin.f90(90): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.

if (mverbose) print *, "Initialized builtin PDF " // &
^
[ Aborting due to internal error. ]
compilation aborted for pdf_builtin.f90 (code 1)

0 Kudos
jr_reuter
Beginner
891 Views
Hi Kevin,
well I did a bit more of rewriting to convert this to F90:
module mrst2004qed

use iso_varying_string

contains

subroutine mrstqed (x,q,mode,upv,dnv,usea,dsea,str,chm,bot, &
xglu,phot,prefix)
type(varying_string) prefix
data xmin,xmax,qsqmin,qsqmax/1d-5,1d0,1.25d0,1d7/
integer runit, estat
q2=q*q
runit = 6
open(unit=runit,file=char (prefix) // '/qed6-10gridp.dat', &
status='old', iostat=estat)
close (runit)
return
end subroutine mrstqed

subroutine mrst1 (prefix)
use iso_varying_string
implicit real*8(a-h,o-z)
type(varying_string) prefix

return
end subroutine mrst1

end module

*****
When I do this then ifort recognizes the missing subroutines ctq6pdf (from a left-out module), and when I include that module then ifort 12.0 compiles the code.
0 Kudos
Steven_L_Intel1
Employee
891 Views
I recommend against using ISO_VARYING_STRINGS - it is known to have memory leaks. The Intel compiler supports the Fortran 2003 feature of deferred-length allocatable character variables which work much better than ISO_VARYING_STRINGS and are integrated into the language.
0 Kudos
jr_reuter
Beginner
891 Views
Thanks for your comment -- in fact, we would love to switch to
allocatable character variables, but the code has to be portable, and
not all vendors do support this (yet).

We have been using ISO_VARYING_STRING throughout our code for a long
time, and I can actually recommend it. In particular, it has a few
useful convenience procedures that deserve to become part of the
standard. Since we are working with an implementation with allocatable
arrays (no array pointers), memory leaks are not an issue.

Our tests with valgrind have not shown any memory leaks up to now.
0 Kudos
Kevin_D_Intel
Employee
891 Views
The internal error reported earlier in this thread and tracked under the Internal tracking id: DPD200164649 is fixed in the Intel Fortran Composer XE 2011 Update 4 (2011.4.191 - Linux)
0 Kudos
Reply