https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71729
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |jakub at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Don't do it then. -z noexecstack asserts there are no trampolines in the code, but your code does need trampolines and thus executable stack, because you are passing address of a nested (contained) subroutine/function to another and not optimizing, so it is not inlined.