1219019Sgabor! { dg-do run } 2219019Sgabor! Tests the fix for PR30284, in which the substring plus 3219019Sgabor! component reference for an internal file would cause an ICE. 4219019Sgabor! 5219019Sgabor! Contributed by Harald Anlauf <anlauf@gmx.de> 6219019Sgabor 7219019Sgaborprogram gfcbug51 8219019Sgabor implicit none 9219019Sgabor 10219019Sgabor type :: date_t 11219019Sgabor character(len=12) :: date ! yyyymmddhhmm 12219019Sgabor end type date_t 13219019Sgabor 14219019Sgabor type year_t 15219019Sgabor integer :: year = 0 16219019Sgabor end type year_t 17219019Sgabor 18219019Sgabor type(date_t) :: file(3) 19219019Sgabor type(year_t) :: time(3) 20219019Sgabor 21219019Sgabor FILE%date = (/'200612231200', '200712231200', & 22219019Sgabor '200812231200'/) 23219019Sgabor 24219019Sgabor call date_to_year (FILE) 25219019Sgabor if (any (time%year .ne. (/2006, 2007, 2008/))) call abort () 26219019Sgabor 27219019Sgabor call month_to_date ((/8, 9, 10/), FILE) 28219019Sgabor if ( any (file%date .ne. (/'200608231200', '200709231200', & 29219019Sgabor '200810231200'/))) call abort () 30219019Sgabor 31219019Sgaborcontains 32219019Sgabor 33219019Sgabor subroutine date_to_year (d) 34219019Sgabor type(date_t) :: d(3) 35219019Sgabor read (d%date(1:4),'(i4)') time%year 36219019Sgabor end subroutine 37219019Sgabor 38219019Sgabor subroutine month_to_date (m, d) 39219019Sgabor type(date_t) :: d(3) 40219019Sgabor integer :: m(:) 41219019Sgabor write (d%date(5:6),'(i2.2)') m 42219019Sgabor end subroutine month_to_date 43219019Sgabor 44219019Sgaborend program gfcbug51 45219019Sgabor