- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
using ifort 9.1 or 10.1 my program compiles without any errors. With ifort 11.1 I get some "undefined reference to `myfunc_' ". That means, that ifort cannot find myfunc, although this function is at the beginning of the same source file and the same module as the later call in a subroutine.
Does anyone know, if the ifort 11.1 contains a bug?
Best regards
dnoack
using ifort 9.1 or 10.1 my program compiles without any errors. With ifort 11.1 I get some "undefined reference to `myfunc_' ". That means, that ifort cannot find myfunc, although this function is at the beginning of the same source file and the same module as the later call in a subroutine.
Does anyone know, if the ifort 11.1 contains a bug?
Best regards
dnoack
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove ",dpythag" from the end of line-4, because its redeclaration there supersedes the module procedure dpythag and inserts a call to an external routine with the same name. Since there is no such external routine presented to the linker, an undefined reference results.
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
no bugs that would be as obvious as you claim this is.
Let's see the source file.
ron
Let's see the source file.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I Have generated a short example which doesn't compile wit ifort 11.0, but compile without any errors with ifort 9.1 and 10.1. What is wrong with this example?
module mod_impl
contains
subroutine sub
double precision :: a,b,c,dpythag
a=1.d0
b=2.d0
c=dpythag(a,b)
end subroutine sub
function dpythag(a,b)
double precision :: a,b,dpythag
dpythag=a*dsqrt(1.d0+(b/a)**2.d0)
end function dpythag
end module mod_impl
program myprog
use mod_impl
call sub
end
module mod_impl
contains
subroutine sub
double precision :: a,b,c,dpythag
a=1.d0
b=2.d0
c=dpythag(a,b)
end subroutine sub
function dpythag(a,b)
double precision :: a,b,dpythag
dpythag=a*dsqrt(1.d0+(b/a)**2.d0)
end function dpythag
end module mod_impl
program myprog
use mod_impl
call sub
end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove ",dpythag" from the end of line-4, because its redeclaration there supersedes the module procedure dpythag and inserts a call to an external routine with the same name. Since there is no such external routine presented to the linker, an undefined reference results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, this solve the problem.
But why ifort 9.1 and 10.1 don't complains about this?
But why ifort 9.1 and 10.1 don't complains about this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do not have those versions at hand, but here is the output from Version 7.0:
Intel Fortran Compiler for 32-bit applications, Version 7.0 Build 20021028Z
Copyright (C) 1985-2002 Intel Corporation. All rights reserved.
EPC Fortran-95 Version F95 Intel:200200:131124
Copyright (c) 1993-2000 EPCL. All Rights Reserved.
impl.f90
module MOD_IMPL
module subroutine SUB
module function DPYTHAG
program MYPROG
17 Lines Compiled
Microsoft Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
-out:impl.exe
impl.obj
impl.obj : error LNK2001: unresolved external symbol _DPYTHAG
impl.exe : fatal error LNK1120: 1 unresolved externals
Note that reporting errors with old versions gets you little unless the same errors also beset the current versions.
Intel Fortran Compiler for 32-bit applications, Version 7.0 Build 20021028Z
Copyright (C) 1985-2002 Intel Corporation. All rights reserved.
EPC Fortran-95 Version F95 Intel:200200:131124
Copyright (c) 1993-2000 EPCL. All Rights Reserved.
impl.f90
module MOD_IMPL
module subroutine SUB
module function DPYTHAG
program MYPROG
17 Lines Compiled
Microsoft Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
-out:impl.exe
impl.obj
impl.obj : error LNK2001: unresolved external symbol _DPYTHAG
impl.exe : fatal error LNK1120: 1 unresolved externals
Note that reporting errors with old versions gets you little unless the same errors also beset the current versions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It was noticed at the time, that those compilers implemented the reference incorrectly, allowing it to be resolved by the module function. We had a discussion about the merits of the case on the forum.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page