| 1 |
! { dg-do compile } |
| 2 |
! PR fortran/30799 |
| 3 |
! Inconsistent handling of bad (invalid) LOGICAL kinds |
| 4 |
! Reporter: Harald Anlauf <[email protected]> |
| 5 |
! Testcase altered by Steven G. Kargl |
| 6 |
program gfcbug57 |
| 7 |
implicit none |
| 8 |
! |
| 9 |
! These are logical kinds known by gfortran and many other compilers: |
| 10 |
! |
| 11 |
print *, kind (.true._1) ! This prints "1" |
| 12 |
print *, kind (.true._2) ! This prints "2" |
| 13 |
print *, kind (.true._4) ! This prints "4" |
| 14 |
print *, kind (.true._8) ! This prints "8" |
| 15 |
! |
| 16 |
! These are very strange (read: bad (invalid?)) logical kinds, |
| 17 |
! handled inconsistently by gfortran (there's no logical(kind=0) etc.) |
| 18 |
! |
| 19 |
print *, kind (.true._0) ! { dg-error "kind for logical constant" } |
| 20 |
print *, kind (.true._3) ! { dg-error "kind for logical constant" } |
| 21 |
print *, kind (.true._123) ! { dg-error "kind for logical constant" } |
| 22 |
! |
| 23 |
! Here gfortran bails out with a runtime error: |
| 24 |
! |
| 25 |
print *, .true._3 ! { dg-error "kind for logical constant" } |
| 26 |
end program gfcbug57 |