nvptx, libgfortran: Switch out of "minimal" mode
[official-gcc.git] / gcc / testsuite / gfortran.dg / alloc_comp_auto_array_1.f90
blobd02fb7c8b2c0e3db3ca9a90a29067541c59ddb87
1 ! { dg-do run }
2 ! Fix for PR29699 - see below for details.
4 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
6 PROGRAM vocabulary_word_count
8 IMPLICIT NONE
9 TYPE VARYING_STRING
10 CHARACTER,DIMENSION(:),ALLOCATABLE :: chars
11 ENDTYPE VARYING_STRING
13 INTEGER :: list_size=200
15 call extend_lists2
17 CONTAINS
19 ! First the original problem: vocab_swap not being referenced caused
20 ! an ICE because default initialization is used, which results in a
21 ! call to gfc_conv_variable, which calls gfc_get_symbol_decl.
23 SUBROUTINE extend_lists1
24 type(VARYING_STRING),DIMENSION(list_size) :: vocab_swap
25 ENDSUBROUTINE extend_lists1
27 ! Curing this then uncovered two more problems: If vocab_swap were
28 ! actually referenced, an ICE occurred in the gimplifier because
29 ! the declaration for this automatic array is presented as a
30 ! pointer to the array, rather than the array. Curing this allows
31 ! the code to compile but it bombed out at run time because the
32 ! malloc/free occurred in the wrong order with respect to the
33 ! nullify/deallocate of the allocatable components.
35 SUBROUTINE extend_lists2
36 type(VARYING_STRING),DIMENSION(list_size) :: vocab_swap
37 allocate (vocab_swap(1)%chars(10))
38 if (.not.allocated(vocab_swap(1)%chars)) STOP 1
39 if (allocated(vocab_swap(10)%chars)) STOP 2
40 ENDSUBROUTINE extend_lists2
42 ENDPROGRAM vocabulary_word_count