diff mbox series

[libfortran] Fix EXECUTE_COMMAND_LINE error return

Message ID 5ff7da8c-5fbb-19a7-d602-e3af3d2a12c2@netcologne.de
State New
Headers show
Series [libfortran] Fix EXECUTE_COMMAND_LINE error return | expand

Commit Message

Thomas Koenig Oct. 9, 2017, 9:34 p.m. UTC
Hello world,

currently, EXECUTE_COMMAND_LINE aborts the program if the called program
is not found, if cmdstat is present, but cmdmsg isn't. This is a 6/7/8
regression.

This patch fixes the issue by simply removing the erronous call to
runtime_error.

Regression-tested.  OK for all affected branches?

Regards

	Thomas

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.

Comments

Janne Blomqvist Oct. 10, 2017, 5:52 a.m. UTC | #1
On Tue, Oct 10, 2017 at 12:34 AM, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hello world,
>
> currently, EXECUTE_COMMAND_LINE aborts the program if the called program
> is not found, if cmdstat is present, but cmdmsg isn't. This is a 6/7/8
> regression.
>
> This patch fixes the issue by simply removing the erronous call to
> runtime_error.
>
> Regression-tested.  OK for all affected branches?
>
> Regards
>
>         Thomas
>
> 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.

Ok, thanks for the patch.
diff mbox series

Patch

Index: intrinsics/execute_command_line.c
===================================================================
--- intrinsics/execute_command_line.c	(Revision 253525)
+++ intrinsics/execute_command_line.c	(Arbeitskopie)
@@ -125,15 +125,9 @@  execute_command_line (const char *command, bool wa
   free (cmd);
 
   /* Now copy back to the Fortran string if needed.  */
-  if (cmdstat && *cmdstat > EXEC_NOERROR)
-    {
-      if (cmdmsg)
-	fstrcpy (cmdmsg, cmdmsg_len, cmdmsg_values[*cmdstat],
+  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]);
-    }
 }