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

Unresolved external references with v18.0

Norman_K_
New Contributor I
274 Views

Dear All

I have encountered an alarming problem with v18, not present on v17, please have a look at the code and comments below

module MOD_A
    implicit none; private
    type, public :: MOD_A_data
        real :: x
    contains
        procedure, pass :: new => MOD_A_new
    end type
    
    public MOD_A_new
    
    interface
        module subroutine MOD_A_new(d)
            class(MOD_A_data) :: d
        end subroutine MOD_A_new
    end interface
end module MOD_A

submodule (MOD_A) MOD_A_subm
    implicit none
    contains
    module subroutine MOD_A_new(d)
        class(MOD_A_data) :: d
        d%x = 10.
    end subroutine MOD_A_new
end submodule MOD_A_subm

program TEST_CON_SUB
use, non_intrinsic :: MOD_A
implicit none
type(MOD_A_data) :: d
call d%new                  !This line causes message A below
!call MOD_A_new(d)          !But this line is absolutely fine (and works)
write(*,*) 'd%x = ', d%x
end program TEST_CON_SUB
 
!Message A from v18.0.1...
!1>------ Build started: Project: Test_cont_sub, Configuration: Debug x64 ------
!1>Compiling with Intel(R) Visual Fortran Compiler 18.0.1.156 [Intel(R) 64]...
!1>Test_cont_sub.f90
!1>Linking...
!1>Test_cont_sub.obj : error LNK2019: unresolved external symbol MOD_A_mp_NEW referenced in function MAIN__
!1>x64\Debug\Test_cont_sub.exe : fatal error LNK1120: 1 unresolved externals
!1>
!1>Build log written to  "blah"
!1>Test_cont_sub - 2 error(s), 0 warning(s)
!========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  
! but from v17.0.6...
    
!1>------ Build started: Project: Test_cont_sub, Configuration: Debug x64 ------
!1>Compiling with Intel(R) Visual Fortran Compiler 17.0.6.270 [Intel(R) 64]...
!1>Test_cont_sub.f90
!1>Linking...
!1>Embedding manifest...
!1>
!1>Build log written to  "blah"
!1>Test_cont_sub - 0 error(s), 0 warning(s)
!========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Law of conservation of bugs?

Thanks

N

0 Kudos
1 Solution
Johannes_Rieke
New Contributor III
274 Views

Hi Norman,

this is quite sure the bug with submodules, which came up with PSXE2018 update 1.

Have a look into this:

https://software.intel.com/en-us/node/740567

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-fo...

https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux...

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-fo...

and more.

A solution will come with PSXE 2018 update 2. Whenever this comes.

Best regards, Johannes

ps: @Intel team: You might like to add a sticky for this bug, because of the frequent questions.

View solution in original post

0 Kudos
2 Replies
Johannes_Rieke
New Contributor III
275 Views

Hi Norman,

this is quite sure the bug with submodules, which came up with PSXE2018 update 1.

Have a look into this:

https://software.intel.com/en-us/node/740567

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-fo...

https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux...

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-fo...

and more.

A solution will come with PSXE 2018 update 2. Whenever this comes.

Best regards, Johannes

ps: @Intel team: You might like to add a sticky for this bug, because of the frequent questions.

0 Kudos
Norman_K_
New Contributor I
274 Views

Dear Johannes

Thanks for your reply.

If this is a known problem and I did not find it by searching on "unresolved external reference" then a sticky may be a good idea.

Others reading this: in the example above the alternative syntax both links and works.

Norman

0 Kudos
Reply