Skip to content

Commit 9e7c5ab

Browse files
abidhAnthony Tran
authored andcommitted
[OMPIRBuilder] Fix use of uninitialized variable. (llvm#145883)
The code in `OpenMPIRBuilder::getTargetEntryUniqueInfo` calls `ID.getDevice()` even when `getUniqueID` has failed and ID is un-initialized. This caused a sanitizer fail for me in llvm#145026. Fix it by giving a default value to `ID`. The value chosen is the same as used in `OpenMPToLLVMIRTranslation.cpp`.
1 parent 10546fc commit 9e7c5ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9846,7 +9846,7 @@ void OffloadEntriesInfoManager::getTargetRegionEntryFnName(
98469846
TargetRegionEntryInfo
98479847
OpenMPIRBuilder::getTargetEntryUniqueInfo(FileIdentifierInfoCallbackTy CallBack,
98489848
StringRef ParentName) {
9849-
sys::fs::UniqueID ID;
9849+
sys::fs::UniqueID ID(0xdeadf17e, 0);
98509850
auto FileIDInfo = CallBack();
98519851
uint64_t FileID = 0;
98529852
std::error_code EC = sys::fs::getUniqueID(std::get<0>(FileIDInfo), ID);

0 commit comments

Comments
 (0)