And turn on the Undefined Behavior Sanitizer (<a href="http:&#x2F;&#x2F;clang.llvm.org&#x2F;docs&#x2F;UndefinedBehaviorSanitizer.html" rel="nofollow">http:&#x2F;&#x2F;clang.llvm.org&#x2F;docs&#x2F;UndefinedBehaviorSanitizer.html</a>) with<p><pre><code>  -fsanitize=undefined
</code></pre>
It would have caught this bug at run-time.