"Error: Asm: [movq mem??,reg64] invalid combination of opcode and operands" when compiling with -CR

Summary and how to reproduce

The attached testcase fails to compile with FPC 3.2.4-rc1 on Linux x86_64.

test_prog.dpr

test_fpc324_bonetimeline.pas

Compiling with

fpc -Mobjfpc -CR test_prog.dpr

results in error:

Free Pascal Compiler version 3.2.4-rc1 [2024/07/20] for x86_64
Copyright (c) 1993-2024 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test_prog.dpr
Compiling test_fpc324_bonetimeline.pas
generics.collections.pas(1279,20) Note: Call to subroutine "function TEnumerable<Test_FPC324_BoneTimeline.TVector2>.GetEnumerator:TEnumerator$1<TEST_FPC324_BONETIMELINE.TVector2>;" marked as inline is not inlined
test_fpc324_bonetimeline.pas(29,3) Note: Local variable "V" is assigned but never used
generics.collections.pas(150,52) Note: Private type "TCustomPointersEnumerator$2<TEST_FPC324_BONETIMELINE.TVector2,TEST_FPC324_BONETIMELINE.TCustomList$1$crcC964CAFF.PT>.T" never used
test_fpc324_bonetimeline.pas(45,3) Error: Asm: [movq mem??,reg64] invalid combination of opcode and operands
test_fpc324_bonetimeline.pas(50,3) Error: Asm: [movq mem??,reg64] invalid combination of opcode and operands
Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Error: /home/michalis/installed/fpclazarus/fpc324-official/fpc/bin/ppcx64 returned an error exitcode

FPC versions tested

Problem occurs with

The testcase compiles OK with:

  • FPC 3.2.2
  • the latest main branch (FPC 3.3.1), revision b790ea1a , latest on 2025-06-24 .

All above on Linux, x86_64, regular Ubuntu 24.04.

Notes

Note: To reproduce the problem:

  • Debug option -CR must be present. Compilation works OK without this option.

  • inline at Lerp is necessary to produce the bug. Otherwise compilation goes OK, even with -CR.

  • Placing the code in a program directly, not in a unit, also makes the issue go away. Only when the testcase is in a unit, the problem occurs (and it doesn't matter if you compile a unit like fpc -Mobjfpc -CR test_fpc324_bonetimeline.pas or a trivial program using this unit like fpc -Mobjfpc -CR test_prog.dpr).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information