summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/module_equivalence_2.f90
blob: f6a3c34039bbcc8cfd0d16ad2322696b562da2da (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
! { dg-do run }
! Tests the fix for PR27269 and PR27xxx.
! The former caused a segfault in trying to process
! module b, with an unused equivalence in a. The latter
! produced an assembler error due to multiple declarations
! for a module equivalence, when one of the variables was
! initialized, as M in module a.
!
module a
  integer, parameter :: dp = selected_real_kind (10)
  real(dp) :: reM, M = 1.77d0
  equivalence (M, reM)
end module a

module b
  use a, only : dp
end module b

  use a
  use b
  if (reM .ne. 1.77d0) call abort ()
  reM = 0.57d1
  if (M .ne. 0.57d1) call abort ()
end
! { dg-final { cleanup-modules "a b" } }