The attached patch fixes PR 62296 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62296). The Fortran interpretation there was a bit confused (see links to comp.lang.fortran thread from the PR), but the consensus is that the standard makes a difference between the command-line returning with nonzero status (which sets EXITSTAT) and the command-line not being able to execute at all (which sets CMDSTAT and CMDMSG).
The attached patch recognizes this by checking the return value of system() for magic values 126 and 127, which are used by various combinations of shells and libc to indicate that the shell could not be executed. The attached testcase checks that. Bootstrapped and regtested on x86_64-apple-darwin14. OK to commit to trunk? FX PS: I’ve also taken the opportunity to rework a bit the runtime error message issued when CMDSTAT is not present, to actually include the actual error condition message (that which would be CMDMSG if it were present) rather than a generic error message.
execute_command_line.ChangeLog
Description: Binary data
execute_command_line.diff
Description: Binary data