You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The subtraction can be known not to overflow because it's derived from an overflow checked addition. This was reduced/converted to C from this rust bug: rust-lang/rust#58692
One commenter suggested they thought the issue was in how GVN handled overflow checked operations.
Code:
#include <stdlib.h>
extern void panic1();
extern void panic2();
extern void panic3();
size_t f(size_t a, size_t b) {
size_t x;
if (!__builtin_add_overflow(a, b, &x)) {
panic1();
__builtin_unreachable();
}
size_t r;
if (!__builtin_sub_overflow(x, a, &r)) {
panic2();
__builtin_unreachable();
}
if (r < 0) {
panic3();
__builtin_unreachable();
}
return x;
}
Extended Description
Godbolt link: https://godbolt.org/z/h2lkGE
The subtraction can be known not to overflow because it's derived from an overflow checked addition. This was reduced/converted to C from this rust bug: rust-lang/rust#58692
One commenter suggested they thought the issue was in how GVN handled overflow checked operations.
Code:
Assembly:
The text was updated successfully, but these errors were encountered: