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

--- Comment #5 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 applie
You are right(In reply to anlauf from comment #1)
> Error: Integer too big for its kind at (1). This check can be disabled with
> the option '-fno-range-check'
> 
> Why don't you read what gfortran is telling you, and acting appropriately?

Sorry, I made a mistake. You are right.
(In reply to anlauf from comment #1)
> Error: Integer too big for its kind at (1). This check can be disabled with
> the option '-fno-range-check'
> 
> Why don't you read what gfortran is telling you, and acting appropriately?

You are right! I made a mistake, please ignore my previous reply.

The right testcase should be below and it throws out the same prompt.
-------------------------------
program testint
  integer(1) :: x = -128_1
  print *, x
end
-------------------------------

Reply via email to