[llvm] r318462 - Fix some undefined beahvior in FileMapping.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 14:39:55 PST 2017
Author: zturner
Date: Thu Nov 16 14:39:55 2017
New Revision: 318462
URL: http://llvm.org/viewvc/llvm-project?rev=318462&view=rev
Log:
Fix some undefined beahvior in FileMapping.
This was broken when building a 32-bit native toolchain, as
shifting a size_t right by 32 is UB when sizeof(size_t) == 8.
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=318462&r1=318461&r2=318462&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Thu Nov 16 14:39:55 2017
@@ -734,8 +734,8 @@ std::error_code mapped_file_region::init
HANDLE FileMappingHandle =
::CreateFileMappingW(FileHandle, 0, flprotect,
- Size >> 32,
- Size & 0xffffffff,
+ Hi_32(Size),
+ Lo_32(Size),
0);
if (FileMappingHandle == NULL) {
std::error_code ec = mapWindowsError(GetLastError());
More information about the llvm-commits
mailing list