https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116642
--- Comment #11 from Joshua <joshudson at gmail dot com> --- So far I have the following. I have modified the asm stub so that vfork() is an alias for fork(); of course gcc doesn't know about that, and that's the point. If I remove -ffreestanding I can verify the asm is correct but the code doesn't work for other reasons I'm not in a position to fix. If I compile with -mno-sse -mno-sse2 I can verify the asm is correct and this time the binary works. The generated asm with sse looks dodgy but I haven't been able to find a definite fault yet. -ffreestanding does two things. 1) It removes some basic assumptions about what functions do; and 2) it prevents gcc from calling library functions implicitly. I only need the second behavior to suppress internally generated calls to memset. I *think* the bug has something to do with assumptions about what vfork does that just aren't true because it's missing part of the internal name->function sense when -ffreestanding is used. Tell you what: I can try placing volatile on argv[] immediately; if that fixes the problem I'm willing to shut up and say that's perfectly reasonable; on the other hand if it doesn't fix the problem it's time for somebody else to look at it.