From d5cec0ab3741987450382105f0512a8207b99466 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 17 Oct 2023 22:15:45 +0200 Subject: [PATCH] Fix #3103: unaligned.stobj cannot be transformed into inline assignment --- ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs index c666467502..a24783d214 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs @@ -132,6 +132,9 @@ bool TransformInlineAssignmentStObjOrCall(Block block, int pos) } if (block.Instructions[nextPos] is StObj stobj) { + // unaligned.stobj cannot be inlined in C# + if (stobj.UnalignedPrefix > 0) + return false; if (!stobj.Value.MatchLdLoc(inst.Variable)) return false; if (!SemanticHelper.IsPure(stobj.Target.Flags) || inst.Variable.IsUsedWithin(stobj.Target))