[fpc-pascal] Function reference confuses function pointer?

Dwight Schauer das at teegra.net
Sat Mar 4 05:17:44 CET 2023


On 3/3/23 22:08, Hairy Pixels via fpc-pascal wrote:
> This caused me a nasty debugging confusion, it’s a bug right? In the program below the two parameters passed to TBinding.Create have the same address despite being function pointers to two different class methods. Calling them both call the same method which is clearly not correct.
>
> Free Pascal Compiler version 3.3.1 [2022/09/28] for aarch64
2022/09/28?

Does not do this 3.3.1 [2023/03/02] for me. I get different addresses.

$ fpc same.pas
Free Pascal Compiler version 3.3.1 [2023/03/02] for x86_64
Copyright (c) 1993-2023 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling same.pas
same.pas(37,19) Warning: Function result does not seem to be set
Linking same
52 lines compiled, 0.2 sec, 144256 bytes code, 57848 bytes data
1 warning(s) issued

$ ./same
00007FA3B433A080
00007FA3B433A078




More information about the fpc-pascal mailing list