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

qinzhao at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |qinzhao at gcc dot 
gnu.org

--- Comment #11 from qinzhao at gcc dot gnu.org ---
> 
> there are two categories of all the builtin functions provided by GCC to the
> user as documented in gcc documentation:
> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-
> _005f_005fbuiltin_005fcall_005fwith_005fstatic_005fchain
> 
> Category A: a C/C++ language extension (RID_BUILTIN), which is implemented
> in the language FE by the parser. For example, 
> __buitlin_call_with_static_chain,
> __builtin_has_attribute, both belong to this category;
> 
> Category B: a regular builtin that is defined in builtins.def, which is
> implemented in the middle-end. For example, __builtin_object_size,
> __builtin_strcmp_eq, belong to this category;
> 
> From my understanding, the new __builtin_set_counted_by could be either
> implemented in C FE as an C language extension, or in Middle-end as a
> regular builtin. just depend on what's the user interface we are planing to
> provide to the user.

After the discussion with Kees on the major usage of this new builtin, I think
that the above Category A might be a natural fit for this new
__builtin_set_counted_by. i.e, a C language extension (RID_BUILTIN). 

We could define the new __builtin_set_counted_by as

void __builtin_set_counted_by (FAM_exp, count_exp)

The FAM_exp expression must be a flexible array member reference. The second
argument count_exp must be an expression that can be converted to the type of
the flexible array member.

The new RID_BUILTIN will be converted to:

if has_counted_by_attribute (FAM_exp)
 FAM_counted_by_field = count_exp;
else
 ;

Reply via email to