https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111425
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Reduced testcase: enum { REFCOUNT_ADD_NOT_ZERO_OVF } refcount_warn_saturate(); int refcount_inc_not_zero_old, fib_info_num_path___trans_tmp_11, rtnh_ok_remaining, fib_create_info_nexthop_nh_0, fib_create_info_fi; struct rtnexthop { short rtnh_len; } fib_count_nexthops_rtnh; struct nexthop *nh; void atomic_read(int *v) { *(volatile typeof(_Generic(0, default : 0)) *)v; } typedef struct { int refs; } refcount_t; void refcount_inc_not_zero(refcount_t *r) { _Bool __trans_tmp_13; atomic_read(&r->refs); while (!__trans_tmp_13) if (__builtin_expect(refcount_inc_not_zero_old, 0)) refcount_warn_saturate(); } struct nexthop { refcount_t refcnt; }; int fib_info_num_path() { if (__builtin_expect(!nh, 0)) return fib_info_num_path___trans_tmp_11; } int rtnh_ok(struct rtnexthop *rtnh) { return rtnh_ok_remaining && rtnh->rtnh_len <= rtnh_ok_remaining; } void fib_create_info() { struct rtnexthop __trans_tmp_12; while (rtnh_ok(&fib_count_nexthops_rtnh)) fib_count_nexthops_rtnh = __trans_tmp_12; if (nh) refcount_inc_not_zero(&nh->refcnt); for (; fib_info_num_path();) fib_create_info_nexthop_nh_0 = fib_create_info_fi; }