Scott Robert Ladd wrote:
| different from a kind of 4. That way, the native integer(kind=4) could
| impose Fortran's integer model (which rejects -2147483648), while
Fortran doesn't impose an integer model. 13.7. only refers to the
functioning of the intrinsic subroutines. Any number that can be
represented by an integer kind is a valid value for this type. So
there's no need for the code in arith.c that you pointed to originally.
But there's another rule that applies in the discussed case. 13.14. reads:
"... A program is prohibited from invoking an intrinsic procedure under
circumstances where a value to be returned in a subroutine argument or
function result is outside the range of values representable by objects
of the specified type and type parameters."
In other words
I = -2147483647
I = I - 1
PRINT *, ABS(I)
is illegal, even thougfh all of it were allowed if 13.7. were read as a
restriction on the way integers should be dealt with by the compiler. Of
course detecting something like this in all cases is impossible.