This new release included many interesting improvements related to analysis of C and C++ code, about which we'd like to tell our users.
by Andrey Karpov
From the article:
A developer believes that this is a bug in the compiler. Nevertheless, it is the author of the code who is wrong. The function does not work correctly due to the fact that undefined behavior occurs in it. The compiler follows that in the
rvariable a certain
sumis calculated. Overflow of the
rvariable must not happen. Otherwise, it is undefined behavior, which doesn't have to be considered or taken into account by a compiler. So, the compiler thinks that since the value of r variable after ending the loop cannot be negative, then
r & 0x7fffffffoperation is not needed to reset the sigh bit and the compiler just returns the value of
rvariable from the function.