- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(I'm also peter_williamsagilent.com - at home and can't remember psswd & can't access work email. :) ) ANYway.... Here's another bit of code that breaks the compiler. Platform is x86_64 linux.
$ ifort -c breaker.f90
breaker.f90(18): warning #6178: The return value of this FUNCTION has not been defined.
function dummy (i) result (x)
-----------------------------^
breaker.f90(37): catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
thing2 = baz(myfoo%bar,i)
-----------^
compilation aborted for breaker.f90 (code 3)
By the way I can make warning 6178 go away by rewriting function "dummy" below without the "result" clause, but I don't understand why the result clause is causing problems either, so I've included it as is. Again, I'm not sure this is functional Fortran. I seem to uncover these problems playing around with extensible types trying to learn 2003 features, doing the "see if this compiles" method of dinking around.....
Oh yea almost forgot:
peter@cygnus:~$ uname -a
Linux cygnus 2.6.28-14-generic #47-Ubuntu SMP Sat Jul 25 01:19:55 UTC 2009 x86_64 GNU/Linux
peter@cygnus:~$ ifort --version
ifort (IFORT) 11.1 20090630
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
peter@cygnus:~$
-Peter
$ ifort -c breaker.f90
breaker.f90(18): warning #6178: The return value of this FUNCTION has not been defined.
function dummy (i) result (x)
-----------------------------^
breaker.f90(37): catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
thing2 = baz(myfoo%bar,i)
-----------^
compilation aborted for breaker.f90 (code 3)
By the way I can make warning 6178 go away by rewriting function "dummy" below without the "result" clause, but I don't understand why the result clause is causing problems either, so I've included it as is. Again, I'm not sure this is functional Fortran. I seem to uncover these problems playing around with extensible types trying to learn 2003 features, doing the "see if this compiles" method of dinking around.....
Oh yea almost forgot:
peter@cygnus:~$ uname -a
Linux cygnus 2.6.28-14-generic #47-Ubuntu SMP Sat Jul 25 01:19:55 UTC 2009 x86_64 GNU/Linux
peter@cygnus:~$ ifort --version
ifort (IFORT) 11.1 20090630
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
peter@cygnus:~$
-Peter
[plain]module foo_mod
implicit none
type, public :: foo_type
real :: x
contains
procedure, pass :: bar
end type foo_type
contains
real function bar(foo,i)
class(foo_type), intent(in) :: foo
integer, intent(in) :: i
bar = 0.0
end function bar
!
function dummy (i) result (x)
integer :: i
real :: x
x = 1.0 * i
end function dummy
!
real function baz(pap, i)
procedure (dummy), pointer :: pap => null()
integer, intent(in) :: i
baz = pap(i)
end function baz
end module foo_mod
program main
use foo_mod
real :: thing2
type(foo_type) :: myfoo
integer :: i
thing2 = baz(myfoo%bar,i)
end program main[/plain]
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Peter for the convenient reproducer. Unclear where things go awry within the compiler on this one. I forwarded to Development and will update the post as I learn more.
(Internal tracking id: DPD200138694)
(Resolution Update on 11/10/2009): This defect is fixed in the Intel Fortran Compiler Professional Edition 11.1 Update 3, (11.1.059 - Linux).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Kevin Davis (Intel)
Thank you Peter for the convenient reproducer. Unclear where things go awry within the compiler on this one. I forwarded to Development and will update the post as I learn more.
(Internal tracking id: DPD200138694)
Kevin,
Thank you.
I've also got an even simpler bit of code that -while it doesn't cause an internal compiler seg violation - may be related.
Start with this bit of code:
[plain]module modCompile this with ifort with no flags, and it runs fine as expected:
contains
function x1 (i)
x1 = 1.0 * i
end function x1
function x2 (i)
x2 = 2.0 * i
end function x2
end module mod
program main
use mod
procedure (x1), pointer :: xeither => null()
j = 3.0
xeither => x1
y = xeither(j)
write (6,*) y
!
xeither => x2
y = xeither(j)
write (6,*) y
!
end program main
[/plain]
[plain]$ ./a.outNow, let's try to put a new function in the module that takes a procedure pointer as an argument, and we'll pass it a pointer to procedure x1 (say) in the main program:
3.000000
6.000000
$
[/plain]
[plain]module modIt's my understanding this is valid Fortran 2003 use of procedure pointers, but I'm not an expert, so I could be wrong. What I'm expecting is a program that gives me identical output to the original program. However, it doesn't compile, and ifort complains about an internal compiler error:
contains
function x1 (i)
x1 = 1.0 * i
end function x1
function x2 (i)
x2 = 2.0 * i
end function x2
function xwhich (pp,i)
procedure (x1), pointer :: pp
xwhich = pp(i)
end function xwhich
end module mod
program main
use mod
procedure (x1), pointer :: xeither => null()
!
j = 3.0
!
xeither => x1
y = xwhich(xeither,j)
write (6,*) y
!
xeither=> x2
y = xwhich(xeither,j)
write (6,*) y
!
end program main
[/plain]
[plain]$ ifort simple.F90The line number given is a hint. In fact, if we had used a "result" clause in the definition of function x1, we now (in this code, but not the original code) would have gotten a nonsensical complaint that the return value of the function isn't defined. Edit the code to add "result" clause:
simple.F90(8): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
x1 = 1.0 * i
^
[ Aborting due to internal error. ]
compilation aborted for simple.F90 (code 1)
$ [/plain]
[plain]module modand get the nonsensical complaint about return value not being defined:
contains
function x1 (i) result (x)
x = 1.0 * i
end function x1
function x2 (i)
x2 = 2.0 * i
end function x2
function xwhich (pp,i)
procedure (x1), pointer :: pp
xwhich = pp(i)
end function xwhich
end module mod
program main
use mod
procedure (x1), pointer :: xeither => null()
!
j = 3.0
xeither => x1
y = xwhich(xeither,j)
write (6,*) y
!
end program main
[/plain]
[plain]$ ifort simple.F90Hope that helps.
simple.F90(7): warning #6178: The return value of this FUNCTION has not been defined.
function x1 (i) result (x)
--------------------------^
simple.F90(9): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
x = 1.0 * i
^
[ Aborting due to internal error. ]
compilation aborted for simple.F90 (code 1)
$[/plain]
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But check this out - if I NOW put the module function that's supposed to take a procedure pointer, and put it in a SEPARATE module (call it mod2), everything works FINE, plus that old bizarre complaint about the function with a "result" clause not having a defined return value, well, that goes away. Here is the functional code (named simple_works.F90):
So this does appear to be a compiler bug - I *think* the Fortran 2003 standard shouldn't require that xwhich() is defined in a separate module, but maybe I'm wrong, but in any case it breaks the compiler - but, on the other hand, at least in this simple case there's a work-around, plus now there's an even stronger hint about what's going wrong.
Peter
P.S. : I realize now that I should have put
procedure (), pointer :: foo
instead of
procedure (
but in actual fact it doesn't seem to make a difference either way....
[plain]module modand the compilation and run:
contains
function x1 (i) result (x)
x = 1.0 * i
end function x1
!
function x2 (i)
x2 = 2.0 * i
end function x2
end module mod
module mod2
use mod
contains
function xwhich (pp,i)
procedure (x1) :: pp
xwhich = pp(i)
end function xwhich
end module mod2
program main
use mod2
procedure (x1), pointer :: xeither => null()
!
j = 3.0
xeither => x1
y = xwhich(xeither,j)
write (6,*) y
!
xeither => x2
y = xwhich(xeither,j)
write (6,*) y
!
end program main[/plain]
[plain]$ ifort simple_works.F90... which is exactly as expected.
$ ./a.out
3.000000
6.000000
$
[/plain]
So this does appear to be a compiler bug - I *think* the Fortran 2003 standard shouldn't require that xwhich() is defined in a separate module, but maybe I'm wrong, but in any case it breaks the compiler - but, on the other hand, at least in this simple case there's a work-around, plus now there's an even stronger hint about what's going wrong.
Peter
P.S. : I realize now that I should have put
procedure (), pointer :: foo
instead of
procedure (
but in actual fact it doesn't seem to make a difference either way....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This defect (DPD200138694) is fixed in the Intel Fortran Compiler Professional Edition 11.1 Update 3, (11.1.059 - Linux).

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