https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96911

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(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).

Reply via email to