On 05/11/2012 09:07 AM, Janne Blomqvist wrote:
> PING #2!
>
> On Wed, May 2, 2012 at 10:22 PM, Janne Blomqvist
> <
blomqvist.janne@...> wrote:
>> PING
>>
>> On Thu, Apr 26, 2012 at 12:08 AM, Janne Blomqvist
>> <
blomqvist.janne@...> wrote:
>>> Hi,
>>>
>>> currently when -frange-check is enabled, we check for overflow when
>>> doing a formatted read of an integer value. This check, however, is
>>> against the Fortran numerical model (see 13.4 in F2008), which defines
>>> a symmetric interval [-huge(), huge()], whereas all targets gfortran
>>> supports use a two's complement representation with a range of
>>> [-huge()-1, huge()].
>>>
>>> However, there is no checking against the numerical model when doing
>>> arithmetic, and thus we can generate and write the value -huge()-1,
>>> but we cannot read it back in! With the -fno-range-check option, this
>>> overflow checking can be disabled, but at the cost of disabling all
>>> overflow checking, which leads to reading nonsense values if the
>>> hardware supported range overflows.
>>>
>>> The attached patch changes this logic such that overflow checking
>>> against the hardware supported range [-huge()-1, huge()] is always
>>> done when reading, regardless of the -frange-check flag setting. This
>>> also seems to be what ifort 12.0 does, I haven't checked other
>>> compilers.
>>>
>>> For some more arguments back and forth, see the PR.
>>>
>>> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
Patch OK for trunk. In spite of myself, it does not hurt anything.
Regards,
Jerry