瀏覽代碼

* patch by J. Gareth Moreton: fix for incorrect alignment removal, resolves #37420

git-svn-id: trunk@45864 -
florian 5 年之前
父節點
當前提交
a172064767
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      compiler/aoptobj.pas

+ 6 - 2
compiler/aoptobj.pas

@@ -1690,12 +1690,16 @@ Unit AoptObj;
                   if (hp1.typ=ait_instruction) and (taicpu(hp1).is_jmp) then
                   if (hp1.typ=ait_instruction) and (taicpu(hp1).is_jmp) then
                     RemoveDelaySlot(hp1);
                     RemoveDelaySlot(hp1);
 {$endif cpudelayslot}
 {$endif cpudelayslot}
-                  if (hp1.typ = ait_align) then
+                  hp2 := hp1;
+                  while (hp2.typ = ait_align) do
                     begin
                     begin
                       { Only remove the align if a label doesn't immediately follow }
                       { Only remove the align if a label doesn't immediately follow }
-                      if GetNextInstruction(hp1, hp2) and (hp2.typ = ait_label) then
+                      if GetNextInstruction(hp2, hp2) and (hp2.typ = ait_label) then
                         { The label is unskippable }
                         { The label is unskippable }
                         Exit;
                         Exit;
+
+                      { Check again in case there's more than one adjacent alignment entry
+                        (a frequent construct under x86, for example). [Kit] }
                     end;
                     end;
                   asml.remove(hp1);
                   asml.remove(hp1);
                   hp1.free;
                   hp1.free;