From eb4f2b082cc9521ee01a4935fdcf1603a54eee17 Mon Sep 17 00:00:00 2001 From: SingleAccretion Date: Sat, 2 Apr 2022 17:20:21 +0300 Subject: [PATCH] Allow null-based ARR_ADDRs We can sometimes see trees like "ARR_ADDR(long 0)" that are the result of morph's folding logic. In general it does not seem great to allow folding of BYREFs into LONGs like that, but it is also not incorrect per-se. --- src/coreclr/jit/gentree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/gentree.h b/src/coreclr/jit/gentree.h index 86d7f5bb102e6..9751bb93ffd74 100644 --- a/src/coreclr/jit/gentree.h +++ b/src/coreclr/jit/gentree.h @@ -5788,7 +5788,7 @@ struct GenTreeArrAddr : GenTreeUnOp , m_elemType(elemType) , m_firstElemOffset(firstElemOffset) { - assert(addr->TypeIs(TYP_BYREF)); + assert(addr->TypeIs(TYP_BYREF) || addr->IsIntegralConst(0)); assert(((elemType == TYP_STRUCT) && (elemClassHandle != NO_CLASS_HANDLE)) || (elemClassHandle == NO_CLASS_HANDLE));