https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106422
--- Comment #7 from Alexander Monakov <amonakov at gcc dot gnu.org> --- I think item 2 from comment #3 (jump threading) still needs to be solved independently of what is decided about item 1 (leaf functions resuming earlier returns_twice call). --- The problem with 'leaf' is that Glibc is taking the longjmp stipulation from the docs ("a leaf function is not allowed to [...] longjmp into the unit") literally: /* All functions, except those with callbacks or those that synchronize memory, are leaf functions. */ # if __GNUC_PREREQ (4, 6) && !defined _LIBC # define __LEAF , __leaf__ # define __LEAF_ATTR __attribute__ ((__leaf__)) # else # define __LEAF # define __LEAF_ATTR # endif and marks many, many functions including 'execve' leaf, while 'execve' obviously resumes an earlier vfork (if successful). --- In the original testcase we have 'free' which arguably should not resume any returns_twice function, so GIMPLE representation is correct and jump threading needs a fix (or can_duplicate_block_p if we decide it's too conservative and ought to check presence of abnormal edges). Please let me know if I should split off the problem with leaf functions in a separate bug.