integer(kind=1) i ! kind = 1, -128 <= i < 127 select case (i) case (200) ! kind = 4, unreachable because of range of i
Taken from gfortran.dg/select_5.f90. This is valid, but one should print a warning. One may also print an error since having such a case label does not make sense. NAG f95: warning: case label value exceeds maximum value for type g95: Error: Integer overflow in CASE statement at (1) ifort: Error: select_5.f90, line 11: The case-value is out-of-range. -- Summary: Warning if case label value exceeds maximum value for type Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31820