View Issue Details

IDProjectCategoryView StatusLast Update
0038383FPCCompilerpublic2021-01-22 23:03
ReporterJ. Gareth Moreton Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Platformaarch64OSLInux (Raspberry Pi OS) 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038383: [Patch] aarch64 EXTDEBUG fixes and extensions
DescriptionThis patch fixes an issue where Internal Error 2019090802 is raised when attempting to make the compiler under aarch64-linux with EXTDEBUG enabled.

It also adds an extra debug comment in "tcgaarch64.a_load_const_reg" that shows what the original constant was in the assembly dumps, since the multiple mov instructions don't always make it clear what the constant was.
Steps To ReproduceApply patch and build compiler with "make clean all OPT="-dEXTDEBUG" ALLOW_WARNINGS=1" to confirm successful compilation.

When EXTDEBUG is specified, warnings need to be allowed because of how strict the compiler is under these conditions when it comes to temps being freed and location types matching.
Additional InformationThe internal error is in "taicpu.spilling_get_operation_type" and was raised when the compiler doesn't recognise an assembly opcode for register spilling purposes. Under normal rules, it assumes that the first operand is written to and other operands are read from, but under EXTDEBUG It raises an internal error instead.

There is a slight change under normal, non-debug conditions: STLXP, STLXR, STXP and STXR have been removed from the 'case' block (and added to the EXTDEBUG branch) and are now handled by the 'else' branch, because their operand rules coincide with the default handling. This should provide a minor performance boost and reduce code size slightly.
Tagsaarch64, compiler, debug, internal error, patch
Fixed in Revision48337
FPCOldBugId
FPCTarget-
Attached Files

Activities

J. Gareth Moreton

2021-01-22 08:17

developer  

aarch64-extdebug.patch (1,818 bytes)   
Index: compiler/aarch64/aasmcpu.pas
===================================================================
--- compiler/aarch64/aasmcpu.pas	(revision 48225)
+++ compiler/aarch64/aasmcpu.pas	(working copy)
@@ -1018,6 +1018,7 @@
           A_TST,
           A_FCMP,A_FCMPE,
           A_CBZ,A_CBNZ,
+          A_PRFM,A_PRFUM,
           A_RET:
             result:=operand_read;
           A_STR,A_STUR:
@@ -1026,14 +1027,6 @@
             else
               { check for pre/post indexed in spilling_get_operation_type_ref }
               result:=operand_read;
-          A_STLXP,
-          A_STLXR,
-          A_STXP,
-          A_STXR:
-            if opnr=0 then
-              result:=operand_write
-            else
-              result:=operand_read;
           A_STP:
             begin
               if opnr in [0,1] then
@@ -1102,12 +1095,21 @@
            A_FCVTZS,
            A_SDIV,
            A_SMULL,
+           A_STLXP,
+           A_STLXR,
+           A_STXP,
+           A_STXR,
            A_SUB,
+           A_SXTB,
+           A_SXTH,
+           A_SXTW,
            A_UBFIZ,
            A_UBFX,
            A_UCVTF,
            A_UDIV,
-           A_UMULL:
+           A_UMULL,
+           A_UXTB,
+           A_UXTH:
              if opnr=0 then
                result:=operand_write
              else
Index: compiler/aarch64/cgcpu.pas
===================================================================
--- compiler/aarch64/cgcpu.pas	(revision 48225)
+++ compiler/aarch64/cgcpu.pas	(working copy)
@@ -587,6 +587,9 @@
         manipulated_a: tcgint;
         leftover_a: word;
       begin
+{$ifdef extdebug}
+        list.concat(tai_comment.Create(strpnew('Generating constant ' + tostr(a))));
+{$endif extdebug}
         case a of
           { Small positive number }
           $0..$FFFF:
aarch64-extdebug.patch (1,818 bytes)   

Florian

2021-01-22 23:03

administrator   ~0128495

Thanks, applied.

Issue History

Date Modified Username Field Change
2021-01-22 08:17 J. Gareth Moreton New Issue
2021-01-22 08:17 J. Gareth Moreton File Added: aarch64-extdebug.patch
2021-01-22 08:17 J. Gareth Moreton Tag Attached: patch
2021-01-22 08:17 J. Gareth Moreton Tag Attached: debug
2021-01-22 08:17 J. Gareth Moreton Tag Attached: aarch64
2021-01-22 08:17 J. Gareth Moreton Tag Attached: internal error
2021-01-22 08:17 J. Gareth Moreton Tag Attached: compiler
2021-01-22 23:03 Florian Assigned To => Florian
2021-01-22 23:03 Florian Status new => resolved
2021-01-22 23:03 Florian Resolution open => fixed
2021-01-22 23:03 Florian Fixed in Version => 3.3.1
2021-01-22 23:03 Florian Fixed in Revision => 48337
2021-01-22 23:03 Florian FPCTarget => -
2021-01-22 23:03 Florian Note Added: 0128495