Consider this program posted by James Van Buskirk in c.l.f. gfortran currently issues an error because the KIND of 7 and 200 do not match the KIND of x.
program case_ex implicit none integer, parameter :: ik1 = selected_int_kind(2) integer(ik1) x integer io write(*,'(a)',advance='no',iostat=io) ' Enter the value of x:> ' read(*,*) x if(io /= 0) x = 0 select case(x) case(7) write(*,'(a)') ' Sorry, bad guess.' case(200) write(*,'(a)') ' You win the prize!' case default write(*,'(a)') ' You aren''t even trying.' end select end program case_ex The relevant constraint from the Fortran standard is C805 (R808) For a given case-construct, each case-value shall be of the same type as case-expr. For character type, length differences are allowed, but the kind type parameters shall be the same. */ and we note no such requirement of the KIND for INTEGER and LOGICAL variables must match. In the discussion on c.l.f, Richard Maine pointed out that the normal promotion rules for numeric rational operation should be followed. An initial patch was posted to http://gcc.gnu.org/ml/fortran/2004-12/msg00179.html but it was deemed incorrect. -- steve -- Summary: Mismatched KINDs in SELECT CASE constucts is not handled correctly Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sgk at troutmask dot apl dot washington dot edu CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19168