From: Bruce Forstall Date: Tue, 28 Aug 2018 19:00:37 +0000 (-0700) Subject: Fix warning C4723 potential divide by zero X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ead7a76026c7704bfd570669b637495adbd5e92a;p=platform%2Fupstream%2Fcoreclr.git Fix warning C4723 potential divide by zero Appears in VS 15.8 for arm64 builds. Fixes #19715 --- diff --git a/src/vm/ngenhash.inl b/src/vm/ngenhash.inl index 6e5534578e..cc1f139b38 100644 --- a/src/vm/ngenhash.inl +++ b/src/vm/ngenhash.inl @@ -682,6 +682,11 @@ DWORD NgenHashTable::PersistedBucketList::GetBucketSize(DWORD cE #ifndef DACCESS_COMPILE +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4723) // Prevent "warning C4723: potential divide by 0" +#endif // _MSC_VER + // Call during ngen to save hash table data structures into the ngen image. Calls derived-class // implementations of ShouldSave to determine which entries should be serialized, IsHotEntry to hot/cold split // the entries and SaveEntry to allow per-entry extension of the saving process. @@ -806,6 +811,7 @@ void NgenHashTable::BaseSave(DataImage *pImage, CorProfileData * // us to lay out entries into their final order using a linear algorithm in a later phase. if (pMapEntry->m_fHot) { + _ASSERTE(cHotBuckets != 0); pMapEntry->m_dwNewBucket = pMapEntry->m_iHashValue % cHotBuckets; pMapEntry->m_dwChainOrdinal = pHotBucketSizes[pMapEntry->m_dwNewBucket]++; if (pHotBucketSizes[pMapEntry->m_dwNewBucket] > cMaxHotChain) @@ -1006,6 +1012,10 @@ void NgenHashTable::BaseSave(DataImage *pImage, CorProfileData * memset(pNewBuckets, 0, cNewWarmBuckets * sizeof(VolatileEntry*)); } +#ifdef _MSC_VER +#pragma warning(pop) +#endif // _MSC_VER: + // Call during ngen to register fixups for hash table data structure fields. Calls derived-class // implementation of FixupEntry to allow per-entry extension of the fixup process. template