https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99098
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Peter Ross from comment #2) > The following test case produces a -Wfree-nonheap-object false positive. I > argue that the memory being free'd is heap memory. It is offset by one to > accomodate the negative offset applied immediately after malloc. Doing -1 on an allocated memory location is undefined because you can only have the address of 0...size to be taken of the "object" according to the C standard. So the warning might seem wrong but you have undefined code happening.