https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016
--- Comment #31 from Kees Cook <kees at outflux dot net> --- (In reply to Qing Zhao from comment #25) > The source code need to be: > > If (__builtin_get_counted_by (P->FAM)) > __builtin_get_counted_by (P->FAM) = COUNT; > > Yes, I agree that this is good too for the original purpose. And also even > simpler and more flexible. > Kees might have more comments here. (Not sure any other impact on handling > the original problem he had with the new __builtin_get_counted_by). Yeah, I like this. It gives much more obvious semantics instead of hiding a no-op, and this could be used for _reading_ as well as writing the value. This means we could also write, for example, loop constructs with only the FAM: typeof(*__builtin_get_counted_by(P->FAM)) idx; for (idx = 0; idx < *__builtin_get_counted_by(P->FAM); idx++) do_things(P->FAM[idx]);