- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The program below can be compiled and run correctly with the 32 and 64 bit 12.0.2.154 compilers if no options are specified. If the option /warn is used, both compilers abort with
[bash]fortcom: Fatal: There has been an internal compiler error (C0000005). compilation aborted for tsimp.f90 (code 1) [/bash]Here is the program.
[fortran]module funmod
abstract interface
function fn(x) result(y)
real, intent(in) :: x
real :: y
end function fn
end interface
end module funmod
function simp(a,b,h,fun) result(fi) ! integrate fun(x) a-step_h-b
use funmod
procedure(fn) :: fun
real, intent(in):: a,b,h
real :: fi,x,p
integer i,n
n=nint((b-a)/h)
fi=fun(a)+fun(b)
p=4.0
do i=2,n
x=a+(i-1)*h
fi=fi+p*fun(x)
p=6.0-p
end do
fi=fi*(b-a)/(3.0*n)
return
end function simp
function cub(x)
real, intent(in) :: x
cub = x*x*x
return
end
function sqr(x)
real, intent(in) :: x
sqr = x*x
return
end function sqr
program tsimp
use funmod
procedure(fn) :: cub, sqr
real :: a=1.0,b=2.0,h=0.05
interface
function simp(a,b,h,fun) result(fi)
use funmod
procedure(fn) :: fun
real, intent(in) :: a,b,h
real :: fi
end function simp
end interface
write(*,10)'cub',simp(a,b,h,cub)
write(*,10)'sqr',simp(a,b,h,sqr)
10 format(1x,A3,2x,F10.4)
end program tsimp
[/fortran]
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/warn:interface is the culprit here, which is implied by /warn. Either don't use /warn or specify only those suboptions you want (other than "interface"). I will report this to the developers. Issue ID is DPD200166965.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect the fix for this to appear in 12.0 Update 4.
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