#1 2026-07-10 11:57:42

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 91

There is an error in the variant of the latest mormot2.

After pulling the latest version of mormot2, when the program is running, accessing the properties or methods of the variable variant(TdocVariantData) will result in an error.
  In the `mormot.core.variants.InitializeUnit` method, an exception is thrown when the final `test.add` is executed:
   In file ‘mormot.core.base.asmx86.inc' at line 1066:   movaps xmm1,[eax]
 
  win10,win32  lazarus(trunk)+fpc(trunk)

Last edited by lfyey121 (2026-07-10 12:02:39)

Offline

#2 2026-07-10 13:40:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,554
Website

Re: There is an error in the variant of the latest mormot2.

Perhaps they changed something in the fpc trunk, which broke the code.

Please try with supported fpc version, i.e. 3.2 fixes (not 3.2.2).

Edit:
I just tried with latest trunk, no problem in DispInvoke here.

But, on Linux x64, there seem to be an issue with some code generation in Utf8ToWideChar(): the  extra := UTF8_TABLE.Lookup[c]; instruction is clearly not well compiled.
I also tried on Win32 and Win64 and the tests do not pass, due to wrong code generation too.
The trunk codegen seems clearly broken: I looked at the generated asm, and the register allocator is clearly wrong (it uses a register for UTF8_TABLE but then it overwrite it before assuming it is still equal to UTF8_TABLE - clearly a compiler bug).
Perhaps in -O2 or -O1 it could be better. sad

Offline

#3 2026-07-13 03:11:16

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 91

Re: There is an error in the variant of the latest mormot2.

After using FPC 3.2.3 and Lazarus 4.9, the same error still occurred. However, this error will not occur when mormot2 is reverted to version 2.4 stable.

Offline

#4 2026-07-13 04:03:58

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 91

Re: There is an error in the variant of the latest mormot2.

I tested from O1 to O4, and all of them had the same error.

Offline

#5 2026-07-13 06:21:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,554
Website

Re: There is an error in the variant of the latest mormot2.

I can't reproduce it here.

Offline

#6 2026-07-13 10:27:16

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 91

Re: There is an error in the variant of the latest mormot2.

I previously set the compilation parameters for my program. After I changed the compiler options of the mormot2.lpk   to -O2, the program ran without any errors.

Offline

Board footer

Powered by FluxBB