nvptx, libgfortran: Switch out of "minimal" mode
[official-gcc.git] / gcc / testsuite / gfortran.dg / alloc_comp_assign_14.f08
blob7b9c681f6bd686fa98e94c6a47f87c603990e552
1 ! { dg-do run }
2 ! Test for allocatable scalar components and deferred length char arrays.
3 ! Check that fix for pr61275 works.
4 ! Contributed by Antony Lewis <antony@cosmologist.info> and
5 !                Andre Vehreschild <vehre@gmx.de>
7 module typeA
8     Type A
9         integer :: X
10         integer, allocatable :: y
11         character(len=:), allocatable :: c
12     end type A
13 end module
15 program test_allocatable_components
16     use typeA
17     Type(A) :: Me
18     Type(A) :: Ea
20     Me= A(X= 1, Y= 2, C="correctly allocated")
22     if (Me%X /= 1) STOP 1
23     if (.not. allocated(Me%y) .or. Me%y /= 2) STOP 2
24     if (.not. allocated(Me%c)) STOP 3
25     if (len(Me%c) /= 19) STOP 4
26     if (Me%c /= "correctly allocated") STOP 5
28     ! Now check explicitly allocated components.
29     Ea%X = 9
30     allocate(Ea%y)
31     Ea%y = 42
32     ! Implicit allocate on assign in the next line
33     Ea%c = "13 characters"
35     if (Ea%X /= 9) STOP 6
36     if (.not. allocated(Ea%y) .or. Ea%y /= 42) STOP 7
37     if (.not. allocated(Ea%c)) STOP 8
38     if (len(Ea%c) /= 13) STOP 9
39     if (Ea%c /= "13 characters") STOP 10
41     deallocate(Ea%y)
42     deallocate(Ea%c)
43     if (allocated(Ea%y)) STOP 11
44     if (allocated(Ea%c)) STOP 12
45 end program