Skip to content

Commit bda3460

Browse files
committed
init
1 parent a8f7ff2 commit bda3460

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

standard/intent.f90

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module demo
2+
3+
implicit none
4+
5+
contains
6+
7+
subroutine abc()
8+
9+
real, allocatable :: a(:)
10+
11+
allocate(a(1:4))
12+
call out(a)
13+
14+
print *,a
15+
if (.not. allocated(a)) error stop 'should have allocated'
16+
17+
end subroutine abc
18+
19+
20+
subroutine out(a)
21+
22+
real, intent(out) :: a(0:4)
23+
24+
25+
a=[2,3,4,5,6]
26+
27+
28+
end subroutine out
29+
30+
end module demo
31+
32+
program intent
33+
!! explore issues that can arrive over misusing argument intent
34+
!! Fortran 2003 brought auto-allocation (see array/auto_allocate.f90)
35+
!! https://wg5-fortran.org/N1351-N1400/N1379.pdf
36+
37+
use demo, only : abc
38+
39+
call abc()
40+
41+
end program

0 commit comments

Comments
 (0)