URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 303 |
Rev 338 |
! Program to test contained functions calling their siblings.
|
! Program to test contained functions calling their siblings.
|
! This is tricky because we don't find the declaration for the sibling
|
! This is tricky because we don't find the declaration for the sibling
|
! function until after the caller has been parsed.
|
! function until after the caller has been parsed.
|
program contained_3
|
program contained_3
|
call test
|
call test
|
contains
|
contains
|
subroutine test
|
subroutine test
|
if (sub(3) .ne. 6) call abort
|
if (sub(3) .ne. 6) call abort
|
end subroutine
|
end subroutine
|
integer function sub(i)
|
integer function sub(i)
|
integer i
|
integer i
|
if (i .gt. 1) then
|
if (i .gt. 1) then
|
sub = sub2(i) * i
|
sub = sub2(i) * i
|
else
|
else
|
sub = 1
|
sub = 1
|
end if
|
end if
|
end function
|
end function
|
integer function sub2(i)
|
integer function sub2(i)
|
integer i
|
integer i
|
sub2 = sub(i - 1)
|
sub2 = sub(i - 1)
|
end function
|
end function
|
end program
|
end program
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.