[llvm] r315222 - Fix after r315079
Adrian McCarthy via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 9 10:50:01 PDT 2017
Author: amccarth
Date: Mon Oct 9 10:50:01 2017
New Revision: 315222
URL: http://llvm.org/viewvc/llvm-project?rev=315222&view=rev
Log:
Fix after r315079
Microsoft's debug implementation of std::copy checks if the destination is an
array and then does some bounds checking. This was causing an assertion
failure in fs::rename_internal which copies to a buffer of the appropriate
size but that's type-punned to an array of length 1 for API compatibility
reasons.
Fix is to make make the destination a pointer rather than an array.
Modified:
llvm/trunk/lib/Support/Windows/Path.inc
Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=315222&r1=315221&r2=315222&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Mon Oct 9 10:50:01 2017
@@ -372,7 +372,7 @@ static std::error_code rename_internal(H
RenameInfo.ReplaceIfExists = ReplaceIfExists;
RenameInfo.RootDirectory = 0;
RenameInfo.FileNameLength = ToWide.size();
- std::copy(ToWide.begin(), ToWide.end(), RenameInfo.FileName);
+ std::copy(ToWide.begin(), ToWide.end(), &RenameInfo.FileName[0]);
if (!SetFileInformationByHandle(FromHandle, FileRenameInfo, &RenameInfo,
RenameInfoBuf.size()))
More information about the llvm-commits
mailing list