URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [proc_decl_2.f90] - Rev 302
Compare with Previous | Blame | View Log
! { dg-do run }! Various runtime tests of PROCEDURE declarations.! Contributed by Janus Weil <jaydub66@gmail.com>module muse ISO_C_BINDINGabstract interfacesubroutine csub() bind(c)end subroutine csubend interfaceinteger, parameter :: ckind = C_FLOAT_COMPLEXabstract interfacefunction stub() bind(C)import ckindcomplex(ckind) stubend functionend interfaceprocedure():: mp1procedure(real), private:: mp2procedure(mfun), public:: mp3procedure(csub), public, bind(c) :: c, dprocedure(csub), public, bind(c, name="myB") :: bprocedure(stub), bind(C) :: econtainsreal function mfun(x,y)real x,ymfun=4.2end functionsubroutine bar(a,b)implicit noneinterfacesubroutine a()end subroutine aend interfaceoptional :: aprocedure(a), optional :: bend subroutine barsubroutine bar2(x)abstract interfacecharacter function abs_fun()end functionend interfaceprocedure(abs_fun):: xend subroutineend moduleprogram pimplicit noneabstract interfacesubroutine abssub(x)real xend subroutineend interfaceinteger ireal rprocedure(integer):: p1procedure(fun):: p2procedure(abssub):: p3procedure(sub):: p4procedure():: p5procedure(p4):: p6procedure(integer) :: p7i=p1()if (i /= 5) call abort()i=p2(3.1)if (i /= 3) call abort()r=4.2call p3(r)if (abs(r-5.2)>1e-6) call abort()call p4(r)if (abs(r-3.7)>1e-6) call abort()call p5()call p6(r)if (abs(r-7.4)>1e-6) call abort()i=p7(4)if (i /= -8) call abort()r=dummytest(p3)if (abs(r-2.1)>1e-6) call abort()containsinteger function fun(x)real xfun=7end functionsubroutine sub(x)real xend subroutinereal function dummytest(dp)procedure(abssub):: dpreal yy=1.1call dp(y)dummytest=yend functionend program pinteger function p1()p1 = 5end functioninteger function p2(x)real xp2 = int(x)end functionsubroutine p3(x)real,intent(inout):: xx=x+1.0end subroutinesubroutine p4(x)real,intent(inout):: xx=x-1.5end subroutinesubroutine p5()end subroutinesubroutine p6(x)real,intent(inout):: xx=x*2.end subroutinefunction p7(x)implicit noneinteger :: x, p7p7 = x*(-2)end function
