entry_14.f90
来自「用于进行gcc测试」· F90 代码 · 共 104 行
F90
104 行
! { dg-do run }! ! PR fortran/34137!! Entry was previously not possible in a module.! Checks also whether the different result combinations! work properly.!module m1 implicit nonecontainsfunction func(a) implicit none integer :: a, func real :: ent func = a*4 returnentry ent(a) ent = -a*2.0 returnend function funcend module m1module m2 implicit nonecontainsfunction func(a) implicit none integer :: a, func real :: func2 func = a*8 returnentry ent(a) result(func2) func2 = -a*4.0 returnend function funcend module m2module m3 implicit nonecontainsfunction func(a) result(res) implicit none integer :: a, res real :: func2 res = a*12 returnentry ent(a) result(func2) func2 = -a*6.0 returnend function funcend module m3module m4 implicit nonecontainsfunction func(a) result(res) implicit none integer :: a, res real :: ent res = a*16 returnentry ent(a) ent = -a*8.0 returnend function funcend module m4program main implicit none call test1() call test2() call test3() call test4()contains subroutine test1() use m1 implicit none if(func(3) /= 12) call abort() if(abs(ent(7) + 14.0) > tiny(1.0)) call abort() end subroutine test1 subroutine test2() use m2 implicit none if(func(9) /= 72) call abort() if(abs(ent(11) + 44.0) > tiny(1.0)) call abort() end subroutine test2 subroutine test3() use m3 implicit none if(func(13) /= 156) call abort() if(abs(ent(17) + 102.0) > tiny(1.0)) call abort() end subroutine test3 subroutine test4() use m4 implicit none if(func(23) /= 368) call abort() if(abs(ent(27) + 216.0) > tiny(1.0)) call abort() end subroutine test4end program main! { dg-final { cleanup-modules "m1 m2 m3 m4" } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?