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

            Bug ID: 106710
           Summary: Ability to disable -Wfree-nonheap-object for specific
                    free() implementations
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ljrk at ljrk dot org
  Target Milestone: ---

If a library or a system is free-standing, they may have their own free()
implementation that allows not only passing a pointer to the start of the
block-to-be-freed but also to a pointer within.

Currently, GCC warns when it detects a function called `free` which is passed
memory with a nonzero offset from a head object, even if this function is not
the (g)libc's.  Perhaps a similar annotation like for `printf` could be
introduced to annotate functions as memory-handling with selective on/off
switches whether they allow for such behavior or not?

Reply via email to