On Fri, Jan 26, 2024 at 09:23:56PM +0100, FX Coudert wrote:
> 
> This is, for example, legal code (and handled by gfortran as expected):
> 
>   use iso_fortran_env
>   implicit none
>   integer(int8) :: j
>   data j /-128_int8/
>   print *, j
>   end
> 

Interesting example.

% gfcx -o z a.f90 &&  ./z
 -128
% gfcx -o z -pedantic a.f90 && ./z
a.f90:5:20:

    5 |   data j /-128_int8/
      |                    1
Error: Integer too big for its kind at (1). This check can be disabled with the 
option ‘-fno-range-check’
% gfcx -o z -pedantic -fno-range-check a.f90 && ./z
a.f90:5:20:

    5 |   data j /-128_int8/
      |                    1
Error: Integer too big for its kind at (1). This check can be disabled with the 
option ‘-fno-range-check’

:-)

-- 
Steve

Reply via email to