Hi!

I'm a bit confused about the uses of the decls stored in the
implicit_builtin_decls and builtin_decls arrays.  I suppose
the builtin_decls array should contain the __builtin_X variant,
while the implicit_builtin_decls variant should contain the X
variant.  Most of the code emitting calls to f.i. memcpy use
the implicit_builtin_decls variant, but cp/call.c:322 seems
to rely on the fact that even the implicit_builtin_decls variant
contains the __builtin_X variant:

  if (decl && ! TREE_USED (decl))
    {
      /* We invoke build_call directly for several library functions.
         These may have been declared normally if we're building libgcc,
         so we can't just check DECL_ARTIFICIAL.  */
      gcc_assert (DECL_ARTIFICIAL (decl)
                  || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
                               "__", 2));
      mark_used (decl);
    }

apart from some confusing parts of the comment (we're talking about
cp/call.c and still see libgcc mentioned?), using implicit_builtin_decls
variant of memcpy and getting the "memcpy" variant (as asked for(??)),
this assert fires on me.

What is the rationale for this assert?  And what is the rationale for
putting the __builtin_X variant also in implicit_builtin_decls?  What
is the rationale for using the implicit_builtin_decl then, instead of
the builtin_decl?

Thanks,
Richard.

Reply via email to