https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116016

--- Comment #25 from Qing Zhao <qing.zhao at oracle dot com> ---
> --- Comment #24 from Martin Uecker <muecker at gwdg dot de> ---
> 
> A builtin that returns the name or an lvalue for the member would seem to be
> more useful, but then harder to ignore when there is no attribute.

You mean, instead of providing __builtin_set_counted_by (P->FAM, COUNT),
providing the following:

__builtin_get_counted_by (P->FAM)

To return the counted_by field P->count, then let the user to add the
assignment in the source code. 

i.e,  in the source code level, instead of

__builtin_set_counted_by (P->FAM, COUNT);

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).

> 
> But I wonder why a new assignment is needed. Shouldn't there be an assignment
> anyway?

I think the assignment could be easily to be added in the source code.

Reply via email to