https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90329
--- Comment #47 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Kaz Kylheku from comment #45) > Hi everyone. > > Pardon my ignorance of C-Fortran bridging matters, but does any of the > following make sense? > > The Fortran subroutine has no idea whether the word where the argument is > supposed to be is really the argument, or just some unrelated part of the > stack (because the caller didn't pass the argument). > > Can't the Fortran routine check whether that word has the expected value 1? > Then in that case, just pretend it's the argument (whether that is the case, > or whether that 1 is just a spurious value that looks like the right > argument). In this case, just do all the tail calling to sibling routines > happily, who will get the right string length. I see two problems with this suggestion, one minor and one major. First, there may well be a value > 1 on the stack for a regular call, see comment #15. Second, the value 1 may end up being there by accident, then this method would cause a crash, and this would be even harder to debug than the original case.