https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99561
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Fri, Mar 12, 2021 at 06:39:49PM +0000, kargl at gcc dot gnu.org wrote: > --- Comment #1 from kargl at gcc dot gnu.org --- > (In reply to Michal Paszta from comment #0) > > In this line of code: > > > > INTEGER(KIND=1) :: var8 = 257_2 > > > > we try to cast an integer of kind 2 (16 bits) onto an integer of kind 1 (8 > > bits, value up to 256). This will result in a truncation of the value and is > > allowed by the Fortran 2018 Standard, see Table 10.9, Fortran 2018 Standard. > > > > The sentence preceding Table 10.9 and the table tell you > what conversions are allowed and how the conversion is > done via a built-in intrinsic subprogram. > > It does tell you anything about an out-of-range value. It does NOT tell > In fact, an INTEGER(KIND=1) entity has a range of > [-128,127], so the value of 256 is still out-of-range. Sigh, "not" was a rather important omission. :(