This assert was firing when there was a struct with explicit layout and
two byref fields overlapping each other. The assert was checking that
the respective location on the stack was not reported yet.
To fix that, I have changed the assert to fire only if the already
reported kind of reference was different from the current one. That
enables overlapping of two byref fields or two ref fields, but not a
byref and ref fields.
MODE_ANY;
} CONTRACTL_END;
- _ASSERTE(*ppObj == NULL);
- *(CORCOMPILE_GCREFMAP_TOKENS *)ppObj = (dwFlags & GC_CALL_INTERIOR) ? GCREFMAP_INTERIOR : GCREFMAP_REF;
+ CORCOMPILE_GCREFMAP_TOKENS newToken = (dwFlags & GC_CALL_INTERIOR) ? GCREFMAP_INTERIOR : GCREFMAP_REF;
+
+ _ASSERTE((*ppObj == NULL) || (*(CORCOMPILE_GCREFMAP_TOKENS *)ppObj == newToken));
+
+ *(CORCOMPILE_GCREFMAP_TOKENS *)ppObj = newToken;
}
//=================================================================================