op2 = impPopStack().val; // Src addr
op1 = impPopStack().val; // Dst addr
- if (op2->OperGet() == GT_ADDR)
- {
- op2 = op2->AsOp()->gtOp1;
- }
- else
- {
- op2 = gtNewOperNode(GT_IND, TYP_STRUCT, op2);
- }
-
if (op3->IsCnsIntOrI())
{
- size = (unsigned)op3->AsIntConCommon()->IconValue();
- op1 = new (this, GT_BLK) GenTreeBlk(GT_BLK, TYP_STRUCT, op1, typGetBlkLayout(size));
- op1 = gtNewBlkOpNode(op1, op2, (prefixFlags & PREFIX_VOLATILE) != 0, true);
+ size = static_cast<unsigned>(op3->AsIntConCommon()->IconValue());
+
+ op1 = gtNewBlockVal(op1, size);
+ op2 = gtNewBlockVal(op2, size);
+ op1 = gtNewBlkOpNode(op1, op2, (prefixFlags & PREFIX_VOLATILE) != 0, /* isCopyBlock */ true);
}
else
{
- op1 = new (this, GT_STORE_DYN_BLK) GenTreeStoreDynBlk(op1, op2, op3);
- size = 0;
+ op2 = gtNewOperNode(GT_IND, TYP_STRUCT, op2);
+ op1 = new (this, GT_STORE_DYN_BLK) GenTreeStoreDynBlk(op1, op2, op3);
if ((prefixFlags & PREFIX_VOLATILE) != 0)
{
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.CompilerServices;
+
+public unsafe class Runtime_71156
+{
+ public static int Main()
+ {
+ return Problem() ? 101 : 100;
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ private static bool Problem()
+ {
+ float a;
+ var b = 0xFF000000;
+ Unsafe.CopyBlock(&a, &b, 4);
+
+ return *(uint*)&a != 0xFF000000u;
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <Optimize>True</Optimize>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).cs" />
+ </ItemGroup>
+</Project>
\ No newline at end of file