https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117820
--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- >From the standard, the relevent text is: 13.7.2.4 B, O, and Z editing --- The value of m shall not exceed the value of w, except when w is zero. If m is zero and the internal value consists of all zero bits, the output field consists of only blank characters. When m and w are both zero, and the internal value consists of all zero bits, one blank character is produced. --- In the test case here, m = 0 Now digging in a little, look at the results here: program oops integer(8) :: x x = -huge(x) - 1 print *, huge(x) print *, -huge(x) print *, x print *, -huge(x) - 1 print *, -x print '(" huge = <",B64,">")', huge(x) print '(" -huge = <",B64,">")', -huge(x) print '("-huge -1 = <",B64,">")', x print '("-huge -1 = <",B64,">")', -huge(x) - 1 end program !< > $ gfc -fcheck=all -Wall pr117820.f90 $ ./a.out 9223372036854775807 -9223372036854775807 -9223372036854775808 -9223372036854775808 -9223372036854775808 huge = < 111111111111111111111111111111111111111111111111111111111111111> -huge = <1000000000000000000000000000000000000000000000000000000000000001> -huge -1 = <1000000000000000000000000000000000000000000000000000000000000000> -huge -1 = <1000000000000000000000000000000000000000000000000000000000000000> The -9223372036854775808 exceeds the range of kind=8 integer. Using -frange-check does not catch all of these. If I add a couple more print statements: print *, -9223372036854775807 print *, -9223372036854775808 $ gfc -frange-check -Wall pr117820.f90 pr117820.f90:16:31: 16 | print *, -9223372036854775807 | 1 Error: Integer too big for its kind at (1). This check can be disabled with the option ‘-fno-range-check’ pr117820.f90:17:31: 17 | print *, -9223372036854775808 | 1 Error: Integer too big for its kind at (1). This check can be disabled with the option ‘-fno-range-check’ The error at line 16 is not correct. Steve, do you have any comments here.