summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/dec_structure_5.f90
blob: abda3c3e9fbe0f6c314010a5cbbe6cc689058164 (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
! { dg-do run }
! { dg-options "-fdec-structure" }
!
! Test STRUCTUREs which share names with variables.
!

subroutine aborts (s)
  character(*), intent(in) :: s
  print *, s
  call abort()
end subroutine

! Special regression where shared names within a module caused an ICE
! from gfc_get_module_backend_decl
module dec_structure_5m
  structure /s6/
    integer i
  end structure

  record /s6/ s6
end module

program dec_structure_5
  use dec_structure_5m

  structure /s7/
    real r
  end structure

  record /s7/ s7(3)

  s6.i = 0
  s7(1).r = 1.0
  s7(2).r = 2.0
  s7(3).r = 3.0

  if (s6.i .ne. 0) then
    call aborts("s6.i")
  endif

  if (s7(1).r .ne. 1.0) then
    call aborts("s7(1).r")
  endif

  if (s7(2).r .ne. 2.0) then
    call aborts("s7(2).r")
  endif

end