2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / unlimited_polymorphic_23.f90
blob99b5f6b696257a779062a60c88e8d7594a554abb
1 ! { dg-do run }
3 ! Test the fix for PR65024, in which the structure for the 'info'
4 ! component of type 'T' was not being converted into TREE_SSA and
5 ! so caused an ICE in trans-expr.c:gfc_conv_component_ref.
7 ! Reported by <matt@gneilson.plus.com>
9 MODULE X
10 TYPE T
11 CLASS(*), pointer :: info
12 END TYPE
13 END MODULE
15 PROGRAM P
16 call bug
17 CONTAINS
18 SUBROUTINE BUG
19 USE X
20 CLASS(T), pointer :: e
21 integer, target :: i = 42
22 allocate(e)
23 e%info => NULL () ! used to ICE
24 if (.not.associated(e%info)) e%info => i ! used to ICE
25 select type (z => e%info)
26 type is (integer)
27 if (z .ne.i) call abort
28 end select
29 END SUBROUTINE
31 SUBROUTINE NEXT
32 USE X
33 CLASS (T), pointer :: e
34 END SUBROUTINE
35 END