Browse Source

* patch by J. Gareth Moreton: fix compilation with debug info after r43441 and friends, resolves #36299

git-svn-id: trunk@43455 -
florian 5 years ago
parent
commit
5c0a5b73c7
2 changed files with 24 additions and 4 deletions
  1. 16 3
      compiler/aoptobj.pas
  2. 8 1
      compiler/x86/aoptx86.pas

+ 16 - 3
compiler/aoptobj.pas

@@ -1789,8 +1789,15 @@ Unit AoptObj;
             ait_align:
               begin
                 tmp := tai(hp.Next);
-                asml.Remove(hp);
-                hp.Free;
+                if not(
+                  (cs_debuginfo in current_settings.moduleswitches) or
+                  (cs_use_lineinfo in current_settings.globalswitches)
+                ) then
+                  { Don't remove aligns if debuginfo is present }
+                  begin
+                    asml.Remove(hp);
+                    hp.Free;
+                  end;
                 hp := tmp;
                 { Control flow will now return to 'repeat' }
               end;
@@ -1807,7 +1814,13 @@ Unit AoptObj;
                 Exit;
               end;
             else
-              InternalError(2019110801);
+              begin
+                { Might be a comment or temporary allocation entry }
+                if not (hp.typ in SkipInstr) then
+                  InternalError(2019110801);
+
+                hp := tai(hp.Next);
+              end;
           end;
         until False;
       end;

+ 8 - 1
compiler/x86/aoptx86.pas

@@ -3433,7 +3433,14 @@ unit aoptx86;
                                   Continue;
                                 end;
                               else
-                                InternalError(2018062911);
+                                begin
+                                  { Might be a comment or temporary allocation entry }
+                                  if not (hp2.typ in SkipInstr) then
+                                    InternalError(2018062911);
+
+                                  hp2 := tai(hp2.Next);
+                                  Continue;
+                                end;
                             end;
 
                           until False;