cancel
Showing results for 
Search instead for 
Did you mean: 

EPYC Discussions

mfvalin
Adept I

problem with Fortran submodules (function without arguments)

small script to demonstrate the problem
if the module and submodule are in the same file, there is no error at compile time
if the module and submodule are in separate files, ther is an error at compile time
declaring the function as having a single optional argument gets rid of the error

#!/bin/bash
module load aocc/4.0.0   # acquire compiler
export FC=flang
set -x
rm -f *.o *mod
cat <<EOF >file1.F90
module fstd_98
implicit none
type :: fstd98
integer :: iun = -1 ! Fortran unit number
contains
procedure, NOPASS :: fst_version
end type
interface
module function fst_version() result(vers) ! problem if no argumnent
! module function fst_version(dummy) result(vers) ! no problem if optional dummy argument
! implicit none
! integer, optional :: dummy
integer :: vers
end function fst_version
end interface
end module
EOF
cat <<EOF >file2.F90
submodule (fstd_98) fstd_98_sub
contains
module procedure fst_version
implicit none
vers = 123
end procedure
end
EOF
$FC --version
# module and submodule in separate files
$FC -c file1.F90 file2.F90
# all code in a single file
cat file1.F90 file2.F90 >file3.F90
$FC -c file3.F90

 

1 Solution
vtangutu
Staff

Hello mfvalin,

Thanks for reporting this issue.  I have filed a bug report for this issue.  Will keep you posted on the progress of the same.

View solution in original post

0 Likes
3 Replies
vtangutu
Staff

Hello mfvalin,

Thanks for reporting this issue.  I have filed a bug report for this issue.  Will keep you posted on the progress of the same.

0 Likes
nehabhushan94
Journeyman III

Hi @vtangutu . I'm facing a very similar issue currently. Sorry to bump, but is there a solution to this issue yet?

---

 

0 Likes

Hi @nehabhushan94 

Thank you for writing to us.
The resolution for the reported error is expected in next AOCC release(v4.1).

0 Likes