| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-std=f2018" } |
| 3 |
! { dg-require-effective-target fortran_integer_16 } |
| 4 |
! |
| 5 |
! PR fortran/96580 - integer kind of VALUES argument of DATE_AND_TIME intrinsic |
| 6 |
|
| 7 |
program test_time_and_date |
| 8 |
implicit none |
| 9 |
integer(4), dimension(8) :: values4 |
| 10 |
integer(8), dimension(8) :: values8 |
| 11 |
integer(16),dimension(8) :: values16 |
| 12 |
|
| 13 |
call date_and_time(VALUES=values4) |
| 14 |
call date_and_time(VALUES=values8) |
| 15 |
call date_and_time(VALUES=values16) |
| 16 |
|
| 17 |
! Check consistency of year and of time difference from UTC |
| 18 |
if (values16(1) /= -HUGE(0_16) .and. values4(1) /= -HUGE(0_4)) then |
| 19 |
if (abs (values4(1) - values16(1)) > 1) stop 1 |
| 20 |
end if |
| 21 |
if (values16(4) /= -HUGE(0_16) .and. values4(4) /= -HUGE(0_4)) then |
| 22 |
if (values16(4) /= values4(4)) stop 2 |
| 23 |
end if |
| 24 |
if (values4(1) /= -HUGE(0_4) .and. values8(1) /= -HUGE(0_8)) then |
| 25 |
if (abs (values8(1) - values4(1)) > 1) stop 3 |
| 26 |
end if |
| 27 |
if (values4(4) /= -HUGE(0_4) .and. values8(4) /= -HUGE(0_8)) then |
| 28 |
if (values4(4) /= values8(4)) stop 4 |
| 29 |
end if |
| 30 |
end program test_time_and_date |