https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82962
--- Comment #1 from janus at gcc dot gnu.org --- Possible patch: Index: libgfortran/intrinsics/execute_command_line.c =================================================================== --- libgfortran/intrinsics/execute_command_line.c (revision 254678) +++ libgfortran/intrinsics/execute_command_line.c (working copy) @@ -145,10 +145,11 @@ execute_command_line_i4 (const char *command, GFC_ gfc_charlen_type cmdmsg_len) { bool w = wait ? *wait : true; - int estat, estat_initial, cstat; + const int estat_initial = -100; + int estat, cstat; if (exitstat) - estat_initial = estat = *exitstat; + estat = estat_initial; execute_command_line (command, w, &estat, cmdstat ? &cstat : NULL, cmdmsg, command_len, cmdmsg_len); Question is: What's a suitable value for estat_initial? The same changes need to apply to execute_command_line_i8 as well.