File: entry_2.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (51 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
! Test alternate entry points for functions when the result types
! of all entry points match

	character*(*) function f1 (str, i, j)
	character str*(*), e1*(*), e2*(*)
	integer i, j
	f1 = str (i:j)
	return
	entry e1 (str, i, j)
	i = i + 1
	entry e2 (str, i, j)
	j = j - 1
	e2 = str (i:j)
	end function

	character*5 function f3 ()
	character e3*(*), e4*(*)
	integer i
	f3 = 'ABCDE'
	return
	entry e3 (i)
	entry e4 (i)
	if (i .gt. 0) then
	  e3 = 'abcde'
	else
	  e4 = 'UVWXY'
	endif
	end function

	program entrytest
	character f1*16, e1*16, e2*16, str*16, ret*16
	character f3*5, e3*5, e4*5
	integer i, j
	str = 'ABCDEFGHIJ'
	i = 2
	j = 6
	ret = f1 (str, i, j)
	if ((i .ne. 2) .or. (j .ne. 6)) STOP 1
	if (ret .ne. 'BCDEF') STOP 2
	ret = e1 (str, i, j)
	if ((i .ne. 3) .or. (j .ne. 5)) STOP 3
	if (ret .ne. 'CDE') STOP 4
	ret = e2 (str, i, j)
	if ((i .ne. 3) .or. (j .ne. 4)) STOP 5
	if (ret .ne. 'CD') STOP 6
	if (f3 () .ne. 'ABCDE') STOP 7
	if (e3 (1) .ne. 'abcde') STOP 8
	if (e4 (1) .ne. 'abcde') STOP 9
	if (e3 (0) .ne. 'UVWXY') STOP 10
	if (e4 (0) .ne. 'UVWXY') STOP 11
	end program