re PR libfortran/82233 (execute_command_line causes program to stop when command fails (or does not exist))
2017-10-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/82233 * intrinsics/execute_command_line.c (execute_command_line): No call to runtime_error if cmdstat is present. 2017-10-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/82233 * gfortran.dg/execute_command_line_3.f90: New test. From-SVN: r253593
This commit is contained in:
parent
53befce7f2
commit
3934b625ee
4 changed files with 37 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
|||
2017-10-10 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR libfortran/82233
|
||||
* gfortran.dg/execute_command_line_3.f90: New test.
|
||||
|
||||
2017-10-10 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* gcc.target/powerpc/fold-vec-splat-16.c: New
|
||||
|
|
24
gcc/testsuite/gfortran.dg/execute_command_line_3.f90
Normal file
24
gcc/testsuite/gfortran.dg/execute_command_line_3.f90
Normal file
|
@ -0,0 +1,24 @@
|
|||
! { dg-do run }
|
||||
! PR 82233 - there were program aborts for some of these commands.
|
||||
! Original test case by Urban Jost.
|
||||
program boom
|
||||
implicit none
|
||||
integer :: i,j
|
||||
character(len=256) :: msg
|
||||
character(len=:), allocatable :: command
|
||||
command='notthere'
|
||||
msg='' ! seems to only be defined if exitstatus.ne.0
|
||||
! ok -- these work
|
||||
call execute_command_line(command , wait=.false., exitstat=i, cmdstat=j, cmdmsg=msg)
|
||||
if (j /= 0 .or. msg /= '') call abort
|
||||
call execute_command_line(command , exitstat=i, cmdstat=j, cmdmsg=msg )
|
||||
if (j /= 3 .or. msg /= "Invalid command line" ) call abort
|
||||
msg = ''
|
||||
call execute_command_line(command , wait=.false., exitstat=i, cmdmsg=msg )
|
||||
print *,msg
|
||||
if (msg /= '') call abort
|
||||
call execute_command_line(command , exitstat=i, cmdstat=j )
|
||||
if (j /= 3) call abort
|
||||
call execute_command_line(command , wait=.false., exitstat=i )
|
||||
|
||||
end program boom
|
|
@ -1,3 +1,9 @@
|
|||
2017-10-10 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR libfortran/82233
|
||||
* intrinsics/execute_command_line.c (execute_command_line):
|
||||
No call to runtime_error if cmdstat is present.
|
||||
|
||||
2017-09-24 Dominique d'Humieres <dominiq@lps.ens.fr>
|
||||
|
||||
PR libgfortran/79612
|
||||
|
|
|
@ -125,15 +125,9 @@ execute_command_line (const char *command, bool wait, int *exitstat,
|
|||
free (cmd);
|
||||
|
||||
/* Now copy back to the Fortran string if needed. */
|
||||
if (cmdstat && *cmdstat > EXEC_NOERROR)
|
||||
{
|
||||
if (cmdmsg)
|
||||
if (cmdstat && *cmdstat > EXEC_NOERROR && cmdmsg)
|
||||
fstrcpy (cmdmsg, cmdmsg_len, cmdmsg_values[*cmdstat],
|
||||
strlen (cmdmsg_values[*cmdstat]));
|
||||
else
|
||||
runtime_error ("Failure in EXECUTE_COMMAND_LINE: %s",
|
||||
cmdmsg_values[*cmdstat]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue