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.fortran-torture/] [execute/] [st_function.f90] - Rev 303
Compare with Previous | Blame | View Log
! Program to test STATEMENT functionprogram st_fuctioncall simple_casecall with_function_callcall with_character_dummycall with_derived_type_dummycall with_pointer_dummycall multiple_evalcontainssubroutine simple_caseinteger st1, st2integer c(10, 10)st1 (i, j) = i + jst2 (i, j) = c(i, j)if (st1 (1, 2) .ne. 3) call abortc = 3if (st2 (1, 2) .ne. 3 .or. st2 (2, 3) .ne. 3) call abortend subroutinesubroutine with_function_callinteger fun, st3st3 (i, j) = fun (i) + fun (j)if (st3 (fun (2), 4) .ne. 16) call abortend subroutinesubroutine with_character_dummycharacter (len=4) s1, s2, st4character (len=10) st5, s0st4 (i, j) = "0123456789"(i:j)st5 (s1, s2) = s1 // s2if (st4 (1, 4) .ne. "0123" ) call abortif (st5 ("01", "02") .ne. "01 02 ") call abort ! { dg-warning "Character length of actual argument shorter" }end subroutinesubroutine with_derived_type_dummytype personinteger agecharacter (len=50) nameend type persontype (person) me, p, tomtype (person) st6st6 (p) = pme%age = 5me%name = "Tom"tom = st6 (me)if (tom%age .ne. 5) call abortif (tom%name .gt. "Tom") call abortend subroutinesubroutine with_pointer_dummycharacter(len=4), pointer:: p, p1character(len=4), target:: icharacter(len=6) aa (p) = p // '10'p1 => ii = '1234'if (a (p1) .ne. '123410') call abortend subroutinesubroutine multiple_evalinteger st7, fun2, funst7(i) = i + fun(i)if (st7(fun2(10)) .ne. 3) call abortend subroutineend! This functon returns the argument passed on the previous call.integer function fun2 (i)integer iinteger, save :: val = 1fun2 = valval = iend functioninteger function fun (i)integer ifun = i * 2end function
