View Issue Details

IDProjectCategoryView StatusLast Update
0037420FPCCompilerpublic2020-07-26 16:52
ReporterJ. Gareth Moreton Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
PlatformCross-platformOSMicrosoft Windows 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0037420: [Patch] Fix for incorrect alignment removal
DescriptionThis patch fixes a bug in RemoveDeadCodeAfterJump that doesn't properly handle a cluster of alignment fields before a label.
Steps To ReproduceApply patch and confirm correct compilation and bug fix.
Additional InformationWill need testing on all platforms.
Tagscompiler, patch
Fixed in Revision45864
FPCOldBugId
FPCTarget-
Attached Files

Relationships

related to 0031714 resolvedFlorian Compiler: Access Violation on inlined procedure using a local goto instruction 
related to 0035820 resolvedFlorian Any use whatsoever of "label" and "goto" in a procedure marked as inline crashes the compiler. 

Activities

J. Gareth Moreton

2020-07-26 12:46

developer  

align-cluster-removal-fix.patch (1,118 bytes)   
Index: compiler/aoptobj.pas
===================================================================
--- compiler/aoptobj.pas	(revision 45857)
+++ compiler/aoptobj.pas	(working copy)
@@ -1690,12 +1690,16 @@
                   if (hp1.typ=ait_instruction) and (taicpu(hp1).is_jmp) then
                     RemoveDelaySlot(hp1);
 {$endif cpudelayslot}
-                  if (hp1.typ = ait_align) then
+                  hp2 := hp1;
+                  while (hp2.typ = ait_align) do
                     begin
                       { 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 }
                         Exit;
+
+                      { Check again in case there's more than one adjacent alignment entry
+                        (a frequent construct under x86, for example). [Kit] }
                     end;
                   asml.remove(hp1);
                   hp1.free;

Florian

2020-07-26 16:52

administrator   ~0124342

Thanks for the quick fix, applied.

Issue History

Date Modified Username Field Change
2020-07-26 12:46 J. Gareth Moreton New Issue
2020-07-26 12:46 J. Gareth Moreton Status new => assigned
2020-07-26 12:46 J. Gareth Moreton Assigned To => Florian
2020-07-26 12:46 J. Gareth Moreton File Added: align-cluster-removal-fix.patch
2020-07-26 12:47 J. Gareth Moreton Tag Attached: patch
2020-07-26 12:47 J. Gareth Moreton Tag Attached: compiler
2020-07-26 12:47 J. Gareth Moreton Relationship added related to 0031714
2020-07-26 14:01 J. Gareth Moreton Relationship added related to 0035820
2020-07-26 16:52 Florian Status assigned => resolved
2020-07-26 16:52 Florian Resolution open => fixed
2020-07-26 16:52 Florian Fixed in Version => 3.3.1
2020-07-26 16:52 Florian Fixed in Revision => 45864
2020-07-26 16:52 Florian FPCTarget => -
2020-07-26 16:52 Florian Note Added: 0124342