[Bug fortran/38504] double minus sign when printing integer?
kargl at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Dec 12 15:17:00 GMT 2008
------- Comment #3 from kargl at gcc dot gnu dot org 2008-12-12 15:15 -------
(In reply to comment #1)
> Sort of confirmed. You are aware that 'value-1' corresponds to
> '-HUGE(value)-1', which is out of range for integer numbers of that kind?
>
( Ihaven't had my morning coffe, but ...)
No. It is in range. It is the only way (other than TRANSFER) to
get the most negative integer value in a simple assignment. Now,
if you write
value = 9223372036854775807_i8_ + 1
write(*, FMT="(i22)") value, HUGE(value)+1
This results in out of range values, and wrap around semantics
still gives
--9223372036854775808
--9223372036854775808
Also, note that if one uses integer(4), you get the right output.
-2147483647
-2147483647
-2147483648
-2147483648
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38504
More information about the Gcc-bugs
mailing list