On Fri, Aug 14, 2015 at 10:54 AM, FX <fxcoud...@gmail.com> wrote: > 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. > >
Otherwise looks good, but strncat is C99, and we support targets which don't have a C99 libc (been there, done that..). Since in this case you're dealing with string literals rather than user input, it ought to be safe to just use plain strcat (or strlen+memcpy, if you prefer). Ok with that change. -- Janne Blomqvist