Index: clang/lib/Driver/ToolChains/MinGW.cpp =================================================================== --- clang/lib/Driver/ToolChains/MinGW.cpp +++ clang/lib/Driver/ToolChains/MinGW.cpp @@ -160,7 +160,15 @@ } CmdArgs.push_back("-o"); - CmdArgs.push_back(Output.getFilename()); + const char *OutputFile = Output.getFilename(); +#ifdef _WIN32 + if (!llvm::sys::path::filename(OutputFile).contains('.')) + CmdArgs.push_back(Args.MakeArgString(Twine(OutputFile) + ".exe")); + else + CmdArgs.push_back(OutputFile); +#else + CmdArgs.push_back(OutputFile); +#endif Args.AddAllArgs(CmdArgs, options::OPT_e); // FIXME: add -N, -n flags