Skip to content

Compiler Generates wrong info for DispInvoke with late binding of 1 character

Summary

Some problems occurs when running variant late binding with a method name of 1 character.

Regression from FPC 3.2.0 to FPC 3.2.2. Still not fixed in 3.2.3.

System Information

All targets.

Steps to reproduce

No problem when calling variantvalue.toto but variantvalue.a or variantvalue.b have a Parameter with the method name transmitted as #0 so there is no method name to match.

Sounds like a compiler regression. It seems to have nothing to do with mORMot itself: the generated asm have a wrong pointer constant.

What is the current bug behavior?

Any one-char method is not found by DispInvoke.

What is the expected (correct) behavior?

Late binding should work with one character identifiers.

Relevant logs and/or screenshots

See https://synopse.info/forum/viewtopic.php?pid=36185#p36185

Possible fixes

From Alfred:

Its a change in ncal.pas. FPC 3.2.0 and earlier have: tcb.emit_pchar_const(pchar(methodname),length(methodname),true); FPC 3.2.2 and newer have: tcb.emit_pchar_const(pchar(methodname),length(methodname)-1,true);

The change is commented by: { length-1, because the following names variable always starts with #0 which will be the terminator for methodname }

If this change is reverted, all test run green on 3.2.3 and trunk.

Greetings, Alf.

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