http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52428
Bug #: 52428
Summary: [RFC] I/O: READING of "-huge()-1": Integer overflow
Classification: Unclassified
Product: gcc
Version: unknown
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=65825
1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
As reported at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658251
For I/O, reading an integer with value -huge()-1 gives an overflow error.
While that is acceptable based on the Fortran numerical model (cf. Fortran
2008, "13.4 Numeric models"), where the valid integer numbers stretch from
-huge() to huge(), it is rather irritating that one can write (WRITE, PRINT)
those numbers but not READ them back in.
Except for Fortran's numerical model, the number looks valid to me as the sign
belongs to the number and is not an unary operator applied afterwards. For
integer I/O, one reads a "signed-digit-string" (R409).
For the source code, something similar applies: Also there, one does *not* have
an unary minus operator applied to the positive string literal but:
R406 signed-int-literal-constant is [ sign ] int-literal-constant
Only Fortran's numerical model is violated. Contrary to I/O, a error is
printed, which can be overruled using -fno-range-check (and that flag is often
but not always mentioned).
EXPECTED: Be more generous at run time and allow this number for integer input.