1! { dg-do compile }
2! Test the fix for PR28601 in which line 55 would produce an ICE
3! because the rhs and lhs derived times were not identically
4! associated and so could not be cast.
5!
6! Contributed by Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
7!
8module modA
9implicit none
10save
11private
12
13type, public :: typA
14integer :: i
15end type typA
16
17type, public :: atom
18type(typA), pointer :: ofTypA(:,:)
19end type atom
20end module modA
21
22!!! re-name and re-export typA as typB:
23module modB
24use modA, only: typB => typA
25implicit none
26save
27private
28
29public typB
30end module modB
31
32!!! mixed used of typA and typeB:
33module modC
34use modB
35implicit none
36save
37private
38contains
39
40subroutine buggy(a)
41use modA, only: atom
42! use modB, only: typB
43! use modA, only: typA
44implicit none
45type(atom),intent(inout) :: a
46target :: a
47! *** end of interface ***
48
49type(typB), pointer :: ofTypB(:,:)
50! type(typA), pointer :: ofTypB(:,:)
51integer :: i,j,k
52
53ofTypB => a%ofTypA
54
55a%ofTypA(i,j) = ofTypB(k,j)
56end subroutine buggy
57end module modC
58