forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,4 +127,6 @@ if (NOT LFORTRAN_BACKEND) | |
RUN(allocate_01) | ||
RUN(block_01) | ||
RUN(associate_01) | ||
|
||
RUN(functions_01) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
program functions_01 | ||
implicit none | ||
integer :: i, j | ||
i = 1 | ||
j = 1 | ||
if (j /= 1) error stop | ||
j = f(i) | ||
if (i /= 1) error stop | ||
if (j /= 2) error stop | ||
|
||
j = 1 | ||
if (j /= 1) error stop | ||
j = f(3) | ||
if (j /= 4) error stop | ||
|
||
j = 1 | ||
if (j /= 1) error stop | ||
j = f(1+2) | ||
if (j /= 4) error stop | ||
|
||
j = 1 | ||
if (j /= 1) error stop | ||
j = f(i+2) | ||
if (j /= 4) error stop | ||
|
||
contains | ||
|
||
integer function f(a) result(b) | ||
integer, intent(in) :: a | ||
b = a + 1 | ||
end function | ||
|
||
end program |