RTTI.Invoke(): Access violation when passing floating-point parameters
Original Reporter info from Mantis: silvioprog
-
Reporter name: silvioprog
Original Reporter info from Mantis: silvioprog
- Reporter name: silvioprog
Description:
Hi.
Consider the following example:
program project1; {$MODE DELPHI} {$WARN 5079 OFF} uses TypInfo, Rtti; procedure Test1(const d1, d2: Double); begin WriteLn(d1:0:2,' - ', d2:0:2); end; procedure Test2(const d1, d2: Extended); begin WriteLn(d1:0:2,' - ', d2:0:2); end; var a, b: Double; begin a := 12.34; b := 56.78; Rtti.Invoke(@Test1, [a, b], ccReg, nil, True, False); Rtti.Invoke(@Test2, [a, b], ccReg, nil, True, False); ReadLn; end.
When you try to run the code above, it raises the following error:
Error: Project project1 raised exception class 'External: SIGSEGV'. At address 100010768 Stack log: #0 fpc_write_text_float at :0 #1 TEST1(12.34, 56.780000000000001) at project1.lpr:12 #2 INVOKEKERNELWIN64(1, 0x2, 0x0, 0x11cc278) at ..\..\..\..\..\dev\git\freepascal\packages\rtl-objpas\src\x86_64\invoke.inc:69 #3 ?? at :0 #4 ?? at :0
Additional information:
My environment: Lazarus 2.1.0 rUnknown FPC 3.3.1 i386-win32-win32/win64
Mantis conversion info:
- Mantis ID: 34496
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 40666 (#93e0cd9e)