[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#658251: gfortran-4.6: Minimum integer cannot be parsed by read statement



> Formatted read statement cannot parse the minimum integer by a program
> compiled by gfortran-4.6.

I think the line of thought is that the number -2147483648 == -huge(0)-1
is not a valid integer number as it is outside of Fortran's numerical
model, which assumes that the smallest and the largest number only differ
by the sign. See "13.4 Numeric models", paragraph 2 of the Fortran 2008
standard [1]. (While the most common binary integer representation in
hardware allows for integers ranging from -huge(0)-1 to huge(0).)

With the same argument, gfortran also rejects such integer literals
in the source code. However, there the flag -fno-range-check can be used
to still accept the value.

For I/O, I concur that being able to write such a number but not being
able to read it back it, is unexpected and should be fixed.

I filled an upstream problem report (PR) at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52428


[1] Final Draft International Standard (FDIS) of Fortran 2008
(ISO/IEC 1539-1:2010):
ftp://ftp.nag.co.uk/sc22wg5/N1801-N1850/N1830.pdf



Reply to: