https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117434
--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Richard Biener from comment #4) > The executable stack thing happens when a trampoline is required to handle > the nested function. Optimization will sometimes elide the nested function > call via inlining. Iff this detail is not part of the fortran ABI you could > resort to use heap trampolines - not sure how to activate this from the > frontend side, > IIRC darwin uses those (activated from the target side). Ian might know. >From memory, Fortran's use of nested functions is nothing new, certainly one of the reasons I implemented the heap trampoline version on Darwin was to support Fortran on Arm64-darwin where executable stack is not permitted. If a platform decides to shift to a security profile that does not permit executable stack, then I guess you do have a way forward which is to implement the heap support (in libgcc) and then to enable that by default. Or, perhaps, the Fortran spec needs to add the appropriate incantation to enable executable stack to link lines (but that will need target-specific configuration).