[patch,libgfortran] Handle invalid command line in EXECUTE_COMMAND_LINE
FX
fxcoudert@gmail.com
Fri Aug 14 07:54:00 GMT 2015
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: execute_command_line.ChangeLog
Type: application/octet-stream
Size: 441 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150814/aa81d5e2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: execute_command_line.diff
Type: application/octet-stream
Size: 2362 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150814/aa81d5e2/attachment-0001.obj>
More information about the Fortran
mailing list