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

            Bug ID: 122705
           Summary: Add function attributes to mark functions that return
                    a pointer parameter, verbatim or derived
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: [email protected]
  Target Milestone: ---

It would be very useful to mark certain functions, such as strcpy(3) or
strstr(3), as returning a pointer derived from one of the parameters.

I propose [[gnu::returns_input_ptr(1)]] for strcpy(3),
and [[gnu::returns_derived_ptr(1)]] for strstr(3),
where in both attributes, the '1' is a parameter index, indicating
which parameter is the provenance of the returned pointer.

Reply via email to