Without this patch were asserting with a generic message Failed to create Target, but we already have a detailed error message stored in the variable error after calling lookupTarget() but this error was not getting used/printed.
With this patch we will emit a message with more details instead of a stack dump with a generic message.
I tried
unsigned diagID = ci.getDiagnostics().getCustomDiagID(clang:: DiagnosticsEngine::Fatal, "unable to create target: '%0'"); ci.getDiagnostics().Report(diagID) << error;it prints the error but does not terminate flang-new invocation for some reason.