https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108448
--- Comment #19 from Gavin Howard <gavin at yzena dot com> --- Understood. If I had to guess, and this is a *wild* guess, it's because I'm putting a pointer to a function in the allocation. As far as I can tell, this is still allowed, per the docs: > Attribute `malloc` indicates that a function is `malloc`-like, > i.e., that the pointer P returned by the function cannot alias > any other pointer valid when the function returns, and moreover > no pointers to valid objects occur in any storage addressed by P. The important point is "no pointers to valid objects occur in any storage addressed by P." IIRC, "objects" in C does *not* include function pointers, i.e., anything in `.TEXT`. However, because I am putting a *pointer* in the allocation, GCC might be treating that as UB w.r.t. the docs. Of course, I could completely misunderstand what is meant by "objects," so correct me if I am wrong.