| 1 |
! { dg-do run } |
| 2 |
! { dg-require-effective-target fortran_integer_16 } |
| 3 |
! { dg-additional-options "-funsigned" } |
| 4 |
! |
| 5 |
! PR fortran/115788 - OUT_OF_RANGE |
| 6 |
|
| 7 |
program p |
| 8 |
use iso_fortran_env, only: real32, real64 |
| 9 |
implicit none |
| 10 |
unsigned(16) :: u16 |
| 11 |
real(real32) :: r |
| 12 |
real(real64) :: d |
| 13 |
|
| 14 |
u16 = huge(0U_16) |
| 15 |
if (.not. OUT_OF_RANGE (u16 ,r)) stop 1 |
| 16 |
if (.not. OUT_OF_RANGE (huge(0U_16),r)) stop 2 |
| 17 |
if ( OUT_OF_RANGE (u16 ,d)) stop 3 |
| 18 |
if ( OUT_OF_RANGE (huge(0U_16),d)) stop 4 |
| 19 |
|
| 20 |
! This still fits into a 32-bit IEEE float |
| 21 |
u16 = huge(0U_16)/65536U_16*65535U_16 |
| 22 |
if ( OUT_OF_RANGE (u16 ,r)) stop 5 |
| 23 |
if ( OUT_OF_RANGE (huge(0U_16)/65536U_16*65535U_16,r)) stop 6 |
| 24 |
|
| 25 |
end |