2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / arrayio_11.f90
blob04735d11bec23a2d8fefbefac1e4ea7afb12583e
1 ! { dg-do run }
2 ! Tests the fix for PR30284, in which the substring plus
3 ! component reference for an internal file would cause an ICE.
5 ! Contributed by Harald Anlauf <anlauf@gmx.de>
7 program gfcbug51
8 implicit none
10 type :: date_t
11 character(len=12) :: date ! yyyymmddhhmm
12 end type date_t
14 type year_t
15 integer :: year = 0
16 end type year_t
18 type(date_t) :: file(3)
19 type(year_t) :: time(3)
21 FILE%date = (/'200612231200', '200712231200', &
22 '200812231200'/)
24 call date_to_year (FILE)
25 if (any (time%year .ne. (/2006, 2007, 2008/))) call abort ()
27 call month_to_date ((/8, 9, 10/), FILE)
28 if ( any (file%date .ne. (/'200608231200', '200709231200', &
29 '200810231200'/))) call abort ()
31 contains
33 subroutine date_to_year (d)
34 type(date_t) :: d(3)
35 read (d%date(1:4),'(i4)') time%year
36 end subroutine
38 subroutine month_to_date (m, d)
39 type(date_t) :: d(3)
40 integer :: m(:)
41 write (d%date(5:6),'(i2.2)') m
42 end subroutine month_to_date
44 end program gfcbug51