File: modfile41.f90

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (102 lines) | stat: -rw-r--r-- 2,802 bytes parent folder | download | duplicates (14)
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