https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96911
--- Comment #4 from zhen...@compiler-dev.com --- (In reply to kargl from comment #2) > (In reply to zhen.xu from comment #0) > > Dealing with Intrinsic shifta/shiftl/shiftr, gfortran refuses proper numbers > > in the code below and throws "Error: Integer too big for its kind". > > > > The code is checked with ifort. > > > > -------code---------- > > program test > > print *, shifta(-128_1, 1); > > print *, shifta(-32768_2, 1); > > print *, shifta(-2147483648_4, 1); > > print *, shifta(-9223372036854775808_8, 1); > > > > print *, shiftl(-128_1, 1); > > print *, shiftl(-32768_2, 1); > > print *, shiftl(-2147483648_4, 1); > > print *, shiftl(-9223372036854775808_8, 1); > > > > print *, shiftr(-128_1, 1); > > print *, shiftr(-32768_2, 1); > > print *, shiftr(-2147483648_4, 1); > > print *, shiftr(-9223372036854775808_8, 1); > > > > end > > ---------------------- > > There are no negative integer withs gfortran. -128_1 is a unary minus > operator and 128_1 is a invalid operand. 128_1 would be greater than > huge(1_1). The only way to get the most "negative integer" is > to do -huge(1_1) - 1 (assuming twos-complement arithmetic applies). But how can the code below be compiled by gfortran well and print out -128 properly? -------------------- program testint integer(1) :: x = -128 print *, x end ____________________