OSDN Git Service

2010-04-24 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / module_equivalence_3.f90
1 ! { dg-do run }
2 ! This checks the fix for PR32103 in which not using one member
3 ! of an equivalence group would cause all memory of the equivalence
4 ! to be lost and subsequent incorrect referencing of the remaining
5 ! members. 
6 !
7 ! Contributed by Toon Moene <toon@moene.indiv.nluug.nl> 
8 !
9 module aap
10    real :: a(5) = (/1.0,2.0,3.0,4.0,5.0/) 
11    real :: b(3)
12    real :: d(5) = (/1.0,2.0,3.0,4.0,5.0/) 
13    equivalence (a(3),b(1))
14 end module aap
15
16   use aap, only : b
17   call foo
18   call bar
19 !  call foobar
20 contains
21   subroutine foo
22     use aap, only : c=>b
23     if (any(c .ne. b)) call abort ()
24   end subroutine
25   subroutine bar
26     use aap, only : a
27     if (any(a(3:5) .ne. b)) call abort ()
28   end subroutine
29
30 ! Make sure that bad things do not happen if we do not USE a or b.
31
32   subroutine foobar
33     use aap, only : d
34     if (any(d(3:5) .ne. b)) call abort ()
35   end subroutine
36 end
37
38 ! { dg-final { cleanup-modules "aap" } }