Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reenable 4244 #68615

Merged
merged 22 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ if (MSVC)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4201>) # nonstandard extension used : nameless struct/union
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4206>) # nonstandard extension used : translation unit is empty
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4239>) # nonstandard extension used : 'token' : conversion from 'type' to 'type'
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4244>) # conversion from 'type1' to 'type2', possible loss of data
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4245>) # conversion from 'type1' to 'type2', signed/unsigned mismatch
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4291>) # no matching operator delete found; memory will not be freed if initialization throws an exception
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4310>) # cast truncates constant value
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/binder/inc/bindertracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ namespace BinderTracing
};

// This must match the BindingPathSource value map in ClrEtwAll.man
enum PathSource
enum PathSource : uint16_t
{
ApplicationAssemblies,
Unused,
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4794,7 +4794,7 @@ ClrDataAccess::SetAllCodeNotifications(
PTR_HOST_TO_TADDR(((ClrDataModule*)mod)->GetModule()) :
NULL;

if (jn.SetAllNotifications(modulePtr, flags, &changedTable))
if (jn.SetAllNotifications(modulePtr, (USHORT)flags, &changedTable))
{
if (!changedTable ||
(changedTable && jn.UpdateOutOfProcTable()))
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ ClrDataAccess::GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData
MTData->Module = HOST_CDADDR(pMT->GetModule());
MTData->Class = HOST_CDADDR(pMT->GetClass());
MTData->ParentMethodTable = HOST_CDADDR(pMT->GetParentMethodTable());;
MTData->wNumInterfaces = pMT->GetNumInterfaces();
MTData->wNumInterfaces = (WORD)pMT->GetNumInterfaces();
MTData->wNumMethods = pMT->GetNumMethods();
MTData->wNumVtableSlots = pMT->GetNumVtableSlots();
MTData->wNumVirtuals = pMT->GetNumVirtuals();
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/daccess/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3459,7 +3459,7 @@ ClrDataMethodDefinition::SetCodeNotification(
}
else
{
if (jn.SetNotification(modulePtr, m_token, flags) &&
if (jn.SetNotification(modulePtr, m_token, (USHORT)flags) &&
jn.UpdateOutOfProcTable())
{
// new notification added
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/ee/amd64/amd64walker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,9 @@ static bool IsWrite(Amd64InstrDecode::InstrForm form, int pp, bool W, bool L, bo
return isWrite;
}

static int opSize(Amd64InstrDecode::InstrForm form, int pp, bool W, bool L, bool fPrefix66)
static uint8_t opSize(Amd64InstrDecode::InstrForm form, int pp, bool W, bool L, bool fPrefix66)
{
int opSize = 0;
uint8_t opSize = 0;
bool P = !((pp == 1) || fPrefix66);
switch (form)
{
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/dlls/mscorpe/pewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void PERelocSection::AddBaseReloc(unsigned rva, int type, unsigned short highAdj
relocSize++;
unsigned short* offset = (unsigned short*) section->getBlock(2);
if(offset) {
*offset = VAL16((rva & 0xFFF) | (type << 12));
*offset = VAL16((unsigned short)(rva & 0xFFF) | (unsigned short)(type << 12));
}
}

Expand Down Expand Up @@ -1308,7 +1308,7 @@ HRESULT PEWriter::linkSortSections(entry * entries,
_ASSERTE(index == -1 || index == atoi(p));

e->nameLength = (unsigned char)(p - e->name);
e->index = index;
e->index = (char)index;
e->arrayIndex = (unsigned short)(cur - getSectStart());
e++;
}
Expand Down Expand Up @@ -1589,7 +1589,7 @@ HRESULT PEWriter::link() {
iUniqueSections++; // One more for .reloc
filePos = sizeof(IMAGE_DOS_HEADER)+sizeof(x86StubPgm) + m_ntHeadersSize;

m_ntHeaders->FileHeader.NumberOfSections = VAL16(iUniqueSections);
m_ntHeaders->FileHeader.NumberOfSections = (WORD)VAL16(iUniqueSections);

filePos += iUniqueSections * sizeof(IMAGE_SECTION_HEADER);
filePos = roundUp(filePos, VAL32(m_ntHeaders->OptionalHeader.FileAlignment));
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/dlls/mscorpe/pewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ inline unsigned PEWriter::getSubsystem() {
}

inline void PEWriter::setSubsystem(unsigned subsystem, unsigned major, unsigned minor) {
m_ntHeaders->OptionalHeader.Subsystem = VAL16(subsystem);
m_ntHeaders->OptionalHeader.MajorSubsystemVersion = VAL16(major);
m_ntHeaders->OptionalHeader.MinorSubsystemVersion = VAL16(minor);
m_ntHeaders->OptionalHeader.Subsystem = (USHORT)VAL16(subsystem);
m_ntHeaders->OptionalHeader.MajorSubsystemVersion = (USHORT)VAL16(major);
m_ntHeaders->OptionalHeader.MinorSubsystemVersion = (USHORT)VAL16(minor);
}

inline void PEWriter::setCharacteristics(unsigned mask) {
Expand Down
20 changes: 10 additions & 10 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3024,7 +3024,7 @@ void gc_heap::fire_pevents()
// Not every heap will compact LOH, the ones that didn't will just have 0s
// in its info.
FIRE_EVENT(GCLOHCompact,
get_num_heaps(),
(uint16_t)get_num_heaps(),
(uint32_t)(sizeof (etw_loh_compact_info)),
(void *)loh_compact_info);
}
Expand Down Expand Up @@ -5039,7 +5039,7 @@ BOOL gc_heap::reserve_initial_memory (size_t normal_size, size_t large_size, siz

int numa_node = block_index % numa_node_count;
bool pinned_block = block_index >= numa_node_count;
block->memory_base = (uint8_t*)virtual_alloc (block->block_size, use_large_pages_p && !pinned_block, numa_node);
block->memory_base = (uint8_t*)virtual_alloc (block->block_size, use_large_pages_p && !pinned_block, (uint16_t)numa_node);
if (block->memory_base == nullptr)
{
dprintf(2, ("failed to reserve %Id bytes for on NUMA node %u", block->block_size, numa_node));
Expand Down Expand Up @@ -5998,7 +5998,7 @@ class heap_select
uint16_t proc_no[MAX_SUPPORTED_CPUS];
uint16_t node_no[MAX_SUPPORTED_CPUS];
uint16_t max_node_no = 0;
for (int i = 0; i < n_heaps; i++)
for (uint16_t i = 0; i < n_heaps; i++)
{
if (!GCToOSInterface::GetProcessorForHeap (i, &proc_no[i], &node_no[i]))
break;
Expand Down Expand Up @@ -6188,7 +6188,7 @@ class heap_select

for (int i = gc_heap::n_heaps; i < (int)g_num_active_processors; i++)
{
if (!GCToOSInterface::GetProcessorForHeap (i, &proc_no, &node_no))
if (!GCToOSInterface::GetProcessorForHeap ((uint16_t)i, &proc_no, &node_no))
break;

int start_heap = (int)numa_node_to_heap_map[node_no];
Expand All @@ -6211,8 +6211,8 @@ class heap_select
current_heap_on_node = start_heap;
}

proc_no_to_heap_no[proc_no] = current_heap_on_node;
proc_no_to_numa_node[proc_no] = node_no;
proc_no_to_heap_no[proc_no] = (uint16_t)current_heap_on_node;
proc_no_to_numa_node[proc_no] = (uint16_t)node_no;

current_heap_on_node++;
}
Expand Down Expand Up @@ -6263,7 +6263,7 @@ class heap_select
}
} while (!found_node_with_heaps_p);

return start_index;
return (uint16_t)start_index;
}
};
uint8_t* heap_select::sniff_buffer;
Expand Down Expand Up @@ -16178,7 +16178,7 @@ BOOL gc_heap::a_fit_segment_end_p (int gen_number,
{
#ifdef USE_REGIONS
*commit_failed_p = TRUE;
#else
#else
if (!hard_limit_short_seg_end_p)
{
dprintf (2, ("can't grow segment, doing a full gc"));
Expand Down Expand Up @@ -32231,7 +32231,7 @@ heap_segment* gc_heap::walk_relocation_sip (heap_segment* current_heap_segment,
}
else
{
if (!plug_start)
if (!plug_start)
{
plug_start = obj;
}
Expand Down Expand Up @@ -45769,7 +45769,7 @@ void gc_heap::do_post_gc()
last_gc_info->memory_load = settings.exit_memory_load;
else if (settings.entry_memory_load != 0)
last_gc_info->memory_load = settings.entry_memory_load;
last_gc_info->condemned_generation = settings.condemned_generation;
last_gc_info->condemned_generation = (uint8_t)settings.condemned_generation;
last_gc_info->compaction = settings.compaction;
last_gc_info->concurrent = settings.concurrent;

Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/gc/gcee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void GCHeap::ReportGenerationBounds()
{
uint64_t range = static_cast<uint64_t>(rangeEnd - rangeStart);
uint64_t rangeReserved = static_cast<uint64_t>(rangeEndReserved - rangeStart);
FIRE_EVENT(GCGenerationRange, generation, rangeStart, range, rangeReserved);
FIRE_EVENT(GCGenerationRange, (uint8_t)generation, rangeStart, range, rangeReserved);
}, nullptr);
}
}
Expand Down Expand Up @@ -325,19 +325,19 @@ bool GCHeap::IsConcurrentGCInProgress()
}

#ifdef FEATURE_EVENT_TRACE
void gc_heap::fire_etw_allocation_event (size_t allocation_amount,
int gen_number,
void gc_heap::fire_etw_allocation_event (size_t allocation_amount,
int gen_number,
uint8_t* object_address,
size_t object_size)
{
#ifdef FEATURE_REDHAWK
FIRE_EVENT(GCAllocationTick_V1, (uint32_t)allocation_amount, (uint32_t)gen_to_oh (gen_number));
#else
FIRE_EVENT(GCAllocationTick_V4,
allocation_amount,
FIRE_EVENT(GCAllocationTick_V4,
allocation_amount,
(uint32_t)gen_to_oh (gen_number),
heap_number,
object_address,
heap_number,
object_address,
object_size);
#endif //FEATURE_REDHAWK
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/////////////////////////////////////////////////////////////////////////////
////
// This file was auto-generated by a tool at 2020-07-21 14:05:39
// This file was auto-generated by a tool at 2022-04-27 09:53:39
//
// It is recommended you DO NOT directly edit this file but instead edit
// the code-generator that generated this source file instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/////////////////////////////////////////////////////////////////////////////
////
// This file was auto-generated by a tool at 2020-07-21 14:05:39
// This file was auto-generated by a tool at 2022-04-27 09:53:39
//
// It is recommended you DO NOT directly edit this file but instead edit
// the code-generator that generated this source file instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/////////////////////////////////////////////////////////////////////////////
////
// This file was auto-generated by a tool at 2020-07-21 14:05:39
// This file was auto-generated by a tool at 2022-04-27 09:53:39
//
// It is recommended you DO NOT directly edit this file but instead edit
// the code-generator that generated this source file instead.
Expand Down Expand Up @@ -1031,7 +1031,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_01v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_mask_loadu_epi32(_mm512_set1_epi32(MAX),
mask,
Expand All @@ -1041,7 +1041,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_02v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_mask_loadu_epi32(_mm512_set1_epi32(MAX),
Expand All @@ -1053,7 +1053,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_03v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand All @@ -1067,7 +1067,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_04v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand All @@ -1083,7 +1083,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_05v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand All @@ -1101,7 +1101,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_06v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand All @@ -1121,7 +1121,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_07v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand All @@ -1143,7 +1143,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_08v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand All @@ -1167,7 +1167,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_09v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand All @@ -1193,7 +1193,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_10v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand Down Expand Up @@ -1221,7 +1221,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_11v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand Down Expand Up @@ -1251,7 +1251,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_12v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand Down Expand Up @@ -1283,7 +1283,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_13v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand Down Expand Up @@ -1317,7 +1317,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_14v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand Down Expand Up @@ -1353,7 +1353,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_15v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand Down Expand Up @@ -1391,7 +1391,7 @@ template<> struct bitonic<int32_t, AVX512> {
}

static NOINLINE void sort_16v_alt(int32_t *ptr, int remainder) {
const auto mask = 0xFFFF >> ((N - remainder) & (N-1));
const auto mask = (uint16_t)(0xFFFF >> ((N - remainder) & (N-1)));

__m512i d01 = _mm512_loadu_si512((__m512i const *) ptr + 0);;
__m512i d02 = _mm512_loadu_si512((__m512i const *) ptr + 1);;
Expand Down
Loading