Reputation: 1565
I am trying to set an integer using Integer(int64)
and having a problem setting to. When I call huge
, I get 9223372036854775807
. But when I try to set 4807526976
which should be within range I do get a compile error.
Integer (Int64) :: i
Write (*,*) huge (i)
i = 4807526976
Write (*,*) "i: ", i
Compiler is giving me
Error: Integer too big for its kind at (1).
Upvotes: 1
Views: 1380
Reputation: 18118
int64
is not the the default kind for integers. When evaluating the RHS of the assignment, the compiler tries to use the default integer kind for 4807526976
end (consequently) issues the warning.
Specifying the kind manually
i = 4807526976_int64
works like a charm. BTW: ifort
seems to be intelligent enough to correctly chose the kind on its own ;-)
Upvotes: 4