diff --git a/src/coreclr/jit/lsrabuild.cpp b/src/coreclr/jit/lsrabuild.cpp index d90320db3b3e0..8adb111ebc88b 100644 --- a/src/coreclr/jit/lsrabuild.cpp +++ b/src/coreclr/jit/lsrabuild.cpp @@ -3524,11 +3524,11 @@ int LinearScan::BuildStoreLoc(GenTreeLclVarCommon* storeLoc) else if (op1->isContained() && op1->OperIs(GT_BITCAST)) { GenTree* bitCastSrc = op1->gtGetOp1(); - RegisterType registerType = bitCastSrc->TypeGet(); + RegisterType registerType = regType(bitCastSrc->TypeGet()); singleUseRef = BuildUse(bitCastSrc, allRegs(registerType)); Interval* srcInterval = singleUseRef->getInterval(); - assert(srcInterval->registerType == registerType); + assert(regType(srcInterval->registerType) == registerType); srcCount = 1; } #ifndef TARGET_64BIT diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_74373/Runtime_73821.cs b/src/tests/JIT/Regression/JitBlue/Runtime_74373/Runtime_73821.cs new file mode 100644 index 0000000000000..c06276960e107 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_74373/Runtime_73821.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +public class _74373 +{ + public static int Main(string[] args) + { + Problem(10); + return 100; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static unsafe float Problem(long x) + { + var y = BitConverter.Int32BitsToSingle((int)x); + Use(&x); + JitUse(0); + return y; + } + + public static unsafe void Use(long* arg) { } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void JitUse(T arg) { } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_74373/Runtime_73821.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_74373/Runtime_73821.csproj new file mode 100644 index 0000000000000..cf94135633b19 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_74373/Runtime_73821.csproj @@ -0,0 +1,10 @@ + + + Exe + True + true + + + + + \ No newline at end of file