This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/38504] double minus sign when printing integer?
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Dec 2008 15:15:37 -0000
- Subject: [Bug fortran/38504] double minus sign when printing integer?
- References: <bug-38504-11277@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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