arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]
[official-gcc.git] / gcc / testsuite / gfortran.dg / submodule_29.f08
blobc959ade2b73190501962b92353e6b2455bccaa27
1 ! { dg-do run }
3 ! Test the fix for PR80554 in which it was not recognised that the symbol 'i'
4 ! is host associated in the submodule 's' so that the new declaration in the
5 ! submodule was rejected.
7 ! Contributed by Tamas Bela Feher  <tamas.bela.feher@ipp.mpg.de>
9 module M
10   implicit none
11   integer :: i = 0
12   character (100) :: buffer
13   interface
14     module subroutine write_i()
15     end subroutine
16   end interface
17   interface
18     module subroutine write_i_2()
19     end subroutine
20   end interface
21 contains
22   subroutine foo
23     integer :: i
24   end
25 end module
27 submodule (M) S
28     integer :: i = 137
29   contains
30     module subroutine write_i()
31        write (buffer,*) i
32     end subroutine
33 end submodule
35 submodule (M:S) S2
36     integer :: i = 1037
37   contains
38     module subroutine write_i_2()
39        write (buffer,*) i
40     end subroutine
41 end submodule
43 program test_submod_variable
44   use M
45   implicit none
46   integer :: j
47   i = 42
48   call write_i
49   read (buffer, *) j
50   if (i .ne. 42) STOP 1
51   if (j .ne. 137) STOP 2
52   call write_i_2
53   read (buffer, *) j
54   if (i .ne. 42) STOP 3
55   if (j .ne. 1037) STOP 4
56 end program