File: modfile41.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (102 lines) | stat: -rw-r--r-- 2,802 bytes parent folder | download | duplicates (12)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
! RUN: %python %S/test_errors.py %s %flang_fc1
! Test USE statements that use same module multiple times mixed with rename
! clauses and ONLY clauses
module m1
  integer :: a = 1
  integer :: b = 2
end module m1
module m2
  integer :: a = 3
end module m2
module m3
  integer :: a = 1
  type t1
    real t1_value
  end type
  type t2
    complex t2_value
  end type
end module m3
module m4
  use m1
end module m4
module m5
  use m1
  use m1, z=>a
end module m5
module m6
  use m1, only : a
end module m6
program testUse1
  use m1
  use m1,z=>a ! This prevents the use association of m1's "a" as local "a"
  use m2 ! m2's version of "a" gets use associated
  !ERROR: 'a' is use-associated from module 'm2' and cannot be re-declared
  integer :: a = 2
end
subroutine testUse2
  use m1,only : a ! This forces the use association of m1's "a" as local "a"
  use m1,z=>a ! This rename doesn't affect the previous forced USE association
  !ERROR: 'a' is use-associated from module 'm1' and cannot be re-declared
  integer :: a = 2
end
subroutine testUse3
  use m1 ! By itself, this would use associate m1's "a" with a local "a"
  use m1,z=>a ! This rename of m1'a "a" removes the previous use association
  integer :: a = 2
end
subroutine testUse4
  use m1,only : a ! Use associate m1's "a" with local "a"
  use m1,z=>a ! Also use associate m1's "a" with local "z", also pulls in "b"
  !ERROR: 'b' is use-associated from module 'm1' and cannot be re-declared
  integer :: b = 2
end
subroutine testUse5
  use m1,z=>a ! The rename prevents creation of a local "a"
  use m1 ! Does not create a local "a" because of the previous rename
  integer :: a = 2
end
subroutine testUse6
  use m1, z => a ! Hides m1's "a"
  use m1, y => b ! Hides m1's "b"
  integer :: a = 4 ! OK
  integer :: b = 5 ! OK
end
subroutine testUse7
  use m3,t1=>t2,t2=>t1 ! Looks weird but all is good
  type(t1) x
  type(t2) y
  x%t2_value = a
  y%t1_value = z
end
subroutine testUse8
  use m4 ! This USE associates all of m1
  !ERROR: 'a' is use-associated from module 'm4' and cannot be re-declared
  integer :: a = 2
end
subroutine testUse9
  use m5
  integer :: a = 2
end
subroutine testUse10
  use m4
  use m4, z=>a ! This rename erases the USE assocated "a" from m1
  integer :: a = 2
end
subroutine testUse11
  use m6
  use m6, z=>a ! This rename erases the USE assocated "a" from m1
  integer :: a = 2
end
subroutine testUse12
  use m4 ! This USE associates "a" from m1
  use m1, z=>a ! This renames the "a" from m1, but not the one through m4
  !ERROR: 'a' is use-associated from module 'm4' and cannot be re-declared
  integer :: a = 2
end
subroutine testUse13
  use m1, a => a
  use m1, z => a ! should not erase 'a', it was renamed
  !ERROR: 'a' is use-associated from module 'm1' and cannot be re-declared
  integer :: a = 13
end