View Issue Details

IDProjectCategoryView StatusLast Update
0034456FPCCompilerpublic2018-10-29 06:03
ReporterPascal RiekenbergAssigned ToPierre Muller 
PriorityimmediateSeverityblockReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWindows 10 x64OS Version1803
Product Version3.3.1Product Buildr40027 
Target Version3.3.1Fixed in Version3.3.1 
Summary0034456: r40027 breaks build
Descriptionat least for x86_64-win32
TagsNo tags attached.
Fixed in Revisioncommit 40028
FPCOldBugId
FPCTarget
Attached Files
  • i34456.patch (1,529 bytes)
    Index: compiler/x86/agx86int.pas
    ===================================================================
    --- compiler/x86/agx86int.pas	(revision 40027)
    +++ compiler/x86/agx86int.pas	(working copy)
    @@ -886,6 +886,7 @@
                    else if (asminfo^.id=as_x86_64_masm) and
                      (fixed_opcode=A_MOVQ) then
                      writer.AsmWrite(#9#9'mov')
    +{$ifdef i386}
                    else if (asminfo^.id = as_i386_wasm) and ((fixed_opcode=A_RETD)
                            or (fixed_opcode=A_RETND) or (fixed_opcode=A_RETFD)) then
                      begin
    @@ -899,6 +900,22 @@
                              writer.AsmWrite(#9#9'retf');
                        end
                      end
    +{$endif}
    +{$ifdef x86_64}
    +               else if (asminfo^.id = as_i386_wasm) and ((fixed_opcode=A_RETQ)
    +                       or (fixed_opcode=A_RETNQ) or (fixed_opcode=A_RETFD) or (fixed_opcode=A_RETFQ)) then
    +                 begin
    +                   { no 'q' suffix for Watcom assembler }
    +                   case fixed_opcode of
    +                       A_RETQ:
    +                         writer.AsmWrite(#9#9'ret');
    +                       A_RETNQ:
    +                         writer.AsmWrite(#9#9'retn');
    +                       A_RETFD, A_RETFQ:
    +                         writer.AsmWrite(#9#9'retf');
    +                   end
    +                 end
    +{$endif}
                    else
                      writer.AsmWrite(#9#9+prefix+std_op2str[fixed_opcode]+cond2str[taicpu(hp).condition]+suffix);
                    if taicpu(hp).ops<>0 then
    
    i34456.patch (1,529 bytes)

Activities

J. Gareth Moreton

2018-10-25 07:48

developer   ~0111545

Last edited: 2018-10-25 08:43

View 3 revisions

RETD and RETND are not valid under x86-64, as they are specific to 32-bit platforms, On 64-bit, their equivalents are RETQ and RETNQ respectively. Attempting to bulid the compiler under x86-64 will fail because A_RETD and A_RETND are not defined

J. Gareth Moreton

2018-10-25 08:16

developer   ~0111546

The following patch will allow Free Pascal to compile under 64-bit Windows and Linux without difficulty, while retaining the new feature for the Watcom assembler - I have inserted code for 64-bit as well (simply replacing the D opcodes with the Q equivalents), but I am not certain if it is correct or not. Please evaluate with an actual Watcom assembler.

J. Gareth Moreton

2018-10-25 08:41

developer   ~0111547

Some minor fixes. RETFD is actually valid under 64-bit.

J. Gareth Moreton

2018-10-25 08:43

developer  

i34456.patch (1,529 bytes)
Index: compiler/x86/agx86int.pas
===================================================================
--- compiler/x86/agx86int.pas	(revision 40027)
+++ compiler/x86/agx86int.pas	(working copy)
@@ -886,6 +886,7 @@
                else if (asminfo^.id=as_x86_64_masm) and
                  (fixed_opcode=A_MOVQ) then
                  writer.AsmWrite(#9#9'mov')
+{$ifdef i386}
                else if (asminfo^.id = as_i386_wasm) and ((fixed_opcode=A_RETD)
                        or (fixed_opcode=A_RETND) or (fixed_opcode=A_RETFD)) then
                  begin
@@ -899,6 +900,22 @@
                          writer.AsmWrite(#9#9'retf');
                    end
                  end
+{$endif}
+{$ifdef x86_64}
+               else if (asminfo^.id = as_i386_wasm) and ((fixed_opcode=A_RETQ)
+                       or (fixed_opcode=A_RETNQ) or (fixed_opcode=A_RETFD) or (fixed_opcode=A_RETFQ)) then
+                 begin
+                   { no 'q' suffix for Watcom assembler }
+                   case fixed_opcode of
+                       A_RETQ:
+                         writer.AsmWrite(#9#9'ret');
+                       A_RETNQ:
+                         writer.AsmWrite(#9#9'retn');
+                       A_RETFD, A_RETFQ:
+                         writer.AsmWrite(#9#9'retf');
+                   end
+                 end
+{$endif}
                else
                  writer.AsmWrite(#9#9+prefix+std_op2str[fixed_opcode]+cond2str[taicpu(hp).condition]+suffix);
                if taicpu(hp).ops<>0 then
i34456.patch (1,529 bytes)

Pierre Muller

2018-10-25 08:54

developer   ~0111548

Bug confirmed,
commit #40027 does indeed cause
failure to cycle any x86_64 target.

Pierre Muller

2018-10-25 08:55

developer   ~0111549

Compilation error should be fixed by commit 40028.

Please check and close bug report if fix
is confirmed.

Issue History

Date Modified Username Field Change
2018-10-25 06:05 Pascal Riekenberg New Issue
2018-10-25 07:41 J. Gareth Moreton Assigned To => J. Gareth Moreton
2018-10-25 07:41 J. Gareth Moreton Status new => assigned
2018-10-25 07:48 J. Gareth Moreton Note Added: 0111545
2018-10-25 07:49 J. Gareth Moreton Note Edited: 0111545 View Revisions
2018-10-25 08:13 J. Gareth Moreton Priority normal => immediate
2018-10-25 08:13 J. Gareth Moreton Severity minor => block
2018-10-25 08:14 J. Gareth Moreton File Added: i34456.patch
2018-10-25 08:16 J. Gareth Moreton Note Added: 0111546
2018-10-25 08:16 J. Gareth Moreton Status assigned => resolved
2018-10-25 08:16 J. Gareth Moreton Fixed in Version => 3.3.1
2018-10-25 08:16 J. Gareth Moreton Resolution open => fixed
2018-10-25 08:41 J. Gareth Moreton Note Added: 0111547
2018-10-25 08:41 J. Gareth Moreton Status resolved => feedback
2018-10-25 08:41 J. Gareth Moreton Resolution fixed => reopened
2018-10-25 08:42 J. Gareth Moreton File Deleted: i34456.patch
2018-10-25 08:43 J. Gareth Moreton File Added: i34456.patch
2018-10-25 08:43 J. Gareth Moreton Note Edited: 0111545 View Revisions
2018-10-25 08:44 J. Gareth Moreton Status feedback => resolved
2018-10-25 08:44 J. Gareth Moreton Resolution reopened => fixed
2018-10-25 08:54 Pierre Muller Assigned To J. Gareth Moreton => Pierre Muller
2018-10-25 08:54 Pierre Muller Note Added: 0111548
2018-10-25 08:54 Pierre Muller Status resolved => feedback
2018-10-25 08:54 Pierre Muller Resolution fixed => reopened
2018-10-25 08:54 Pierre Muller Target Version => 3.3.1
2018-10-25 08:55 Pierre Muller Fixed in Revision => commit 40028
2018-10-25 08:55 Pierre Muller Note Added: 0111549
2018-10-25 08:55 Pierre Muller Status feedback => resolved
2018-10-25 08:55 Pierre Muller Resolution reopened => fixed
2018-10-29 06:03 Pascal Riekenberg Status resolved => closed