This happens with gcc4 on 64 bit systems.
You are likely doing something like
foo = (int)bar;
Instead, do
foo = (long)bar;