finalyze moving

This commit is contained in:
2025-03-12 14:28:04 +03:00
committed by Dudarenko
parent de4690513b
commit 189374274e
776 changed files with 0 additions and 0 deletions

27
tests/inliner/alex.f Normal file
View File

@@ -0,0 +1,27 @@
integer function sum_(a, b)
integer a, b
sum_ = a + b
end
integer function sub_(a, b)
integer a, b
sub_ = a - b
if (1 .eq. 1) then
return
endif
end
subroutine print_(a)
integer a
write(*,*)a
end
program main
implicit none
integer a, b, res
integer sum_, sub_
a = 1
b = a + 1
res = sum_(sum_(a, b), sub_(a,b))
call print_(res)
end

69
tests/inliner/array_sum.f Normal file
View File

@@ -0,0 +1,69 @@
integer function sum_(a, b)
integer a, b
sum_ = a + b
return
entry mul_(a, b)
mul_ = a * b
return
end
integer function array_sum(a, b, n)
integer n
integer a(n), b(n)
integer i
array_sum = 0
do i = 1, n
array_sum = array_sum + a(i) + b(i)
enddo
end
integer function array_sum2(a, b, n)
integer n
integer a(-1:8), b(n)
integer i
array_sum2 = 0
do i = 1, n
array_sum2 = array_sum2 + a(i-2) + b(i)
enddo
end
integer function array_sum3(a, b, n)
integer i, n, sum_
integer a(-1:8), b(n)
array_sum3 = 0
do i = 1, n
array_sum3 = array_sum3 + sum_(a(i-2), b(i))
enddo
end
subroutine print_(a)
integer a
write(*,*)a
end
subroutine print_array(a, n)
integer i, n
integer a(n)
do i = 1, n
write(*,*)a(i)
enddo
end
program main
implicit none
integer sum_, mul_, array_sum, array_sum2, array_sum3
integer i, s
integer array1(10), array2(10)
do i = 1, 10
array1(i) = i
array2(i) = i
enddo
call print_array(array1, 10)
call print_array(array2, 10)
s = array_sum(array1, array2, 10)
call print_(s)
s = array_sum2(array1, array2, 10)
call print_(s)
s = array_sum3(array1, array2, 10)
call print_(s)
end

View File

@@ -0,0 +1,23 @@
function allocateUsingFunction()
integer AllocateStatus, DeAllocateStatus
real, dimension(:), allocatable :: arr
real allocateUsingFunction
parameter (nx = 10, nx1 = nx + 1)
allocate(arr(0:nx1), STAT = AllocateStatus)
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
do i = 0, nx1
arr(i) = 1
enddo
allocateUsingFunction = arr(0)
deallocate (arr, STAT = DeAllocateStatus)
RETURN
end function allocateUsingFunction
program allocatablesmoketest
real funcResult
real, dimension(:), allocatable :: rra
funcResult = allocateUsingFunction()
print*, "Result", funcResult
end

43
tests/inliner/sub.f Normal file
View File

@@ -0,0 +1,43 @@
integer function sum_(a, b)
integer a, b
sum_ = a + b
return
entry mul_(a, b)
mul_ = a * b
return
end
integer function sub_(a, b)
integer a, b
sub_ = a - b
if (1 .eq. 1) then
return
endif
end
integer function sub2_(a, b)
integer a, b
integer sum_
sub_ = sum_(a, -b)
end
subroutine print_(a)
integer a
write(*,*)a
end
subroutine test()
integer a, b, res, i
integer sum_, sub_, sub2_, mul_, one
a = 1
b = a + 1
call print_(a)
call print_(b)
res = sum_(sub_(a,b), sub2_(a,b))
call print_(res)
end
program main
implicit none
call test
end

59
tests/inliner/test.f Normal file
View File

@@ -0,0 +1,59 @@
integer function sum_(a, b)
integer a, b
sum_ = a + b
return
entry mul_(a, b)
mul_ = a * b
return
end
integer function sub_(a, b)
integer a, b
integer sum_
sub_ = a - b
if (1 .eq. 1) then
return
endif
sub_ = sum_(a, -b)
end
integer function one()
one = 1
end
integer function array_sum(a, b, n)
integer n
integer a(-1:8), b(N)
integer i
array_sum = 0
do i = 1, n
array_sum = array_sum + a(i-2) + b(i)
enddo
end
subroutine print_(a)
integer a
write(*,*)a
end
program main
implicit none
integer a, b, res, i, s
integer sum_, sub_, mul_, one, array_sum
integer array1(10), array2(10)
do i = 1, 10
array1(i) = i
array2(i) = i
enddo
s = array_sum(array1, array2, 10)
call print_(s)
call print_(array_sum(array1, array2, 10))
a = 1
b = a + 1
res = sum_(sum_(one(), b), mul_(1, sub_(a,b)))
if (1 .eq. one()) call print_(1)
do i = 1, one() * 5
call print_(i + one() * one())
enddo
call print_(res)
end