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

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Thomas Schwinge from comment #1)
> David, re (a) and (c), do we teach directly the Analyzer about specific
> functions (like 'acc_malloc', 'acc_free' if '-fopenacc' is enabled), or do
> we add GCC function attributes to designate return value and formal
> parameters as "device" instead of "host" pointer, or something else?

I've done both.

Using the specific hardcoded functions approach (see known_function logic, and
the various hacks in e.g. sm-malloc.cc), is easier to get started with, and
allows for much more complicated semantics, such as "realloc", which has its
own complicated special-case behaviors and is thus a pain to deal with.

Using function attributes is much more flexible in that the end-user can use
them, but perhaps isn't as expressive.

Reply via email to