This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> Please add a @ref to SYSTEM, pointing to the new intrinsic; maybe one should also recommend there to use the F2008 intrinsics (similarly to GETARG/IARGC). OK. > +The @code{COMMAND} argument is passed to the shell and executed, using > +the @code{system()} call. (The shell is @code{sh} on Unix systems, and > > I wonder whether one should add a qualifier before "system", e.g. "the POSIX's system call" or the C library's system call" to make clear that it is not Fortran's SYSTEM call. I changed to "the C library's system() call". > +execute_command_line (const char *command, bool wait, int *exitstat, > > Using 'bool wait' instead of "bool *wait" looks wrong. No call to execute_command_line is emitted directly by the front-end. The library's entry points are execute_command_line_i4 and execute_command_line_i8, which in turn call execute_command_line(). They take care of this and other issues as absent optional arguments (CMDSTAT and EXITSTAT). > set_attr_value (5, false, true, false, false, false); > (or shorter: set_attr_value (2, false, true)) Whow, that's new, and that's neat! > +#if defined(HAVE_FORK) > + if (!wait) > + *cmdstat = 0; > + if ((pid = fork())< 0) > + *cmdstat = EXEC_SYSTEMFAILED; > > That won't work if cmdstat is not available. As F2008 states: > > "If a condition occurs that would assign a nonzero value to CMDSTAT but the CMDSTAT variable is not present, error termination is initiated." I missed that sentence, thanks for pointing it out. > + /* Synchronous execution. */ > + int res = system (cmd); > + > + if (!wait) > + *cmdstat = -2; > > > Ditto for the cmdstat/exitstat. Additionally, I read the standard such that the intrinsic immediately returns with cmdstat = -2 if HAVE_FORK is false - not after the synchronous execution. However, I think the standard is not unambiguous. I agree with you that it's ambiguous, but I think the answer is in the definition of the WAIT argument: "If WAIT is present with the value false, and the processor supports asynchronous execution of the command, the command is executed asynchronously; otherwise it is executed synchronously." I think that part is unambiguous: WAIT = .true. and !HAVE_FORK falls into the "otherwise": the command is actually executed. I have two testsuite failures on x86_64-darwin: trim_optimize_1.f90 and widechar_intrinsics_5.f90. I don't know how they could possibly be related, but my baseline testsuite run is still running. OK to commit if regtest completes OK? FX
Attachment:
exec_2.ChangeLog
Description: Binary data
Attachment:
exec_2.diff
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |