https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92639
--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Wed, Mar 01, 2023 at 05:51:29PM +0000, cessenat at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92639 > > --- Comment #2 from Olivier Cessenat <cessenat at gmail dot com> --- > integer(kind=4) valid range is -2147483648_4 to +2147483647_4. > So I consider this is a gfortran bug. > > Moreover, if -2147483648_4 is considered out of range, why > -2147483647_4 - 1_4 is not ? Constant elimination makes it evaluated to > -2147483648_4. > > I disagree with the term "there are no negative integers" > [-2147483648_4 is equal to +2147483648_4] ^^^^^^^^^^^^ exceeds huge(1) % cat a.f90 print *, huge(1) end % gfortran -o z a.f90 && ./z 2147483647 I've already explained the issue. But, I'll go over it one more time. -2147483648_4 is parsed as unary minus operator and an operand of 2147483648_4. 2147483648_4 exceeds huge(1). Fortunately, gfortran can save you, and the error message even tells you. 1 | i = -2147483648_4 | 1 Error: Integer too big for its kind at (1). This check can be disabled with the option '-fno-range-check' So, let me amend the quote above "there are no negative integer-literal constants."