https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80491
--- Comment #20 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is the full testcase:
#include <stdint.h>
struct pair {
uint64_t low;
uint64_t hi;
};
pair add(pair& a, pair& b) {
pair s;
s.low = a.low + b.low;
s.hi = ((s.low < a.low)+b.hi )+ a.hi ; //carry
return s;
}
pair add1(pair& a, pair& b) {
pair s;
uint64_t t = __builtin_add_overflow ( a.low, b.low, &s.low);
s.hi = b.hi + a.hi +t; //carry
return s;
}
----- CUT -----
At -O1 add gets it correct and has no setc