Browse Source

* TP compatibility: For retro CPUs always copy the function result to
the register(s) on function exit if assembler blocks are present.

Yuriy Sydorov 4 years ago
parent
commit
64ddf22e1b
1 changed files with 7 additions and 1 deletions
  1. 7 1
      compiler/pstatmnt.pas

+ 7 - 1
compiler/pstatmnt.pas

@@ -1085,7 +1085,13 @@ implementation
 
 
          { Mark procedure that it has assembler blocks }
          { Mark procedure that it has assembler blocks }
          include(current_procinfo.flags,pi_has_assembler_block);
          include(current_procinfo.flags,pi_has_assembler_block);
-
+{$if defined(cpu8bitalu) or defined(cpu16bitalu)}
+         { We assume the function result is always used in the TP mode }
+         if (m_tp7 in current_settings.modeswitches) and
+            not (po_assembler in current_procinfo.procdef.procoptions) and
+            assigned(current_procinfo.procdef.funcretsym) then
+           current_procinfo.procdef.funcretsym.IncRefCount;
+{$endif}
          { Read first the _ASM statement }
          { Read first the _ASM statement }
          consume(_ASM);
          consume(_ASM);