Skip to content

[flang][runtime] Fix seg fault in intrinsic execute_command_line #78126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions flang/runtime/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ int TerminationCheck(int status, const Descriptor *cmdstat,
if (!cmdstat) {
terminator.Crash("Execution error with system status code: %d", status);
} else {
CheckAndStoreIntToDescriptor(cmdstat, EXECL_ERR, terminator);
CopyCharsToDescriptor(*cmdmsg, "Execution error");
StoreIntToDescriptor(cmdstat, EXECL_ERR, terminator);
CheckAndCopyCharsToDescriptor(cmdmsg, "Execution error");
}
}
#ifdef _WIN32
Expand All @@ -86,17 +86,17 @@ int TerminationCheck(int status, const Descriptor *cmdstat,
terminator.Crash(
"Invalid command quit with exit status code: %d", exitStatusVal);
} else {
CheckAndStoreIntToDescriptor(cmdstat, INVALID_CL_ERR, terminator);
CopyCharsToDescriptor(*cmdmsg, "Invalid command line");
StoreIntToDescriptor(cmdstat, INVALID_CL_ERR, terminator);
CheckAndCopyCharsToDescriptor(cmdmsg, "Invalid command line");
}
}
#if defined(WIFSIGNALED) && defined(WTERMSIG)
if (WIFSIGNALED(status)) {
if (!cmdstat) {
terminator.Crash("killed by signal: %d", WTERMSIG(status));
} else {
CheckAndStoreIntToDescriptor(cmdstat, SIGNAL_ERR, terminator);
CopyCharsToDescriptor(*cmdmsg, "killed by signal");
StoreIntToDescriptor(cmdstat, SIGNAL_ERR, terminator);
CheckAndCopyCharsToDescriptor(cmdmsg, "killed by signal");
}
}
#endif
Expand All @@ -105,8 +105,8 @@ int TerminationCheck(int status, const Descriptor *cmdstat,
if (!cmdstat) {
terminator.Crash("stopped by signal: %d", WSTOPSIG(status));
} else {
CheckAndStoreIntToDescriptor(cmdstat, SIGNAL_ERR, terminator);
CopyCharsToDescriptor(*cmdmsg, "stopped by signal");
StoreIntToDescriptor(cmdstat, SIGNAL_ERR, terminator);
CheckAndCopyCharsToDescriptor(cmdmsg, "stopped by signal");
}
}
#endif
Expand Down