In Metcalf, Reid & Cohen:
The range of the default integers [in Fortran] is not specified in the language, but in a computer with a word size of n bits, it is often from -2n-1 to +2n-1-1".
(Emphasis on "often" added.)
In machdep/cstuff.c :
#define INT long
#define INT int
This is a bit a risky thing to do. What is probably happening is that the INT data type defined above is larger than the Fortran INTEGER data type on your particular architecture using your particular fortran compiler
. When C dereferences ptr_natom for the purpose of comparing with n, it overflows the Fortran integer and reads some garabage bits (or bits that belong to a different variable). However, the subsequent printf statement is not affected because printf doesn't read all the bits. Indeed, "man 3 printf" says:
l (ell) A following integer conversion corresponds to a long int or unsigned long int argument, or a following n conversion corresponds to a
pointer to a long int argument, or a following c conversion corresponds to a wint_t argument, or a following s conversion corresponds to a
pointer to wchar_t argument.
ll (ell-ell). A following integer conversion corresponds to a long long int or unsigned long long int argument, or a following n conversion
corresponds to a pointer to a long long int argument.