aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/used_types_3.f90
blob: 8273ee420ea20d477c936e3b90e537b6f4d8eb3c (plain)
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
! { dg-do compile }
! Test the fix for PR28601 in which line 55 would produce an ICE
! because the rhs and lhs derived times were not identically
! associated and so could not be cast.
!
! Contributed by Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
!
module modA
implicit none
save
private

type, public :: typA
integer :: i
end type typA

type, public :: atom
type(typA), pointer :: ofTypA(:,:)
end type atom
end module modA

!!! re-name and re-export typA as typB:
module modB
use modA, only: typB => typA
implicit none
save
private

public typB
end module modB

!!! mixed used of typA and typeB:
module modC
use modB
implicit none
save
private
contains

subroutine buggy(a)
use modA, only: atom
! use modB, only: typB
! use modA, only: typA
implicit none
type(atom),intent(inout) :: a
target :: a
! *** end of interface ***

type(typB), pointer :: ofTypB(:,:)
! type(typA), pointer :: ofTypB(:,:)
integer :: i,j,k

ofTypB => a%ofTypA

a%ofTypA(i,j) = ofTypB(k,j)
end subroutine buggy
end module modC