Int64_t aka long long acts as int32_t and overflows at 2^31
1 &lt;&lt; 31 is interpreted by the compiler as (int)1 &lt;&lt; (int)32.
See the implicit types of integer literals. The
rules of usual arithmetic conversions state that no implicit conversion
is performed in this case. The result is then computed as an int, and
it overflows. Note that this is undefined behavior. The assignment
int64_t a = ... converts the (already overflowed) result to the wider
type, without changing its value.

You probably want to write something like:

int64_t a = 1LL &lt;&lt; 31;