Inlined function bug lazarus / 21-General ---------------------------------------------------------------------- engkin · 2021-02-15 02:54 Hi everyone! I think I caught a bug related to inlined functions. Need your help to confirm. I am using Laz 2.0.10 with FPC 3.2.0 Win32 Attached is a sample project. Unzip, compile, and run Change the result of inlined_function in AUnit and run again. I expected the change in the output as well. On my side, the compiler recompiles the unit, but since the value is inlined it is *not* reflected in the other unit BUnit and the output does not change. ---------------------------------------------------------------------- Martin_fr · 2021-02-15 03:48 probably related: https://bugs.freepascal.org/view.php?id=35346#c115730 QuoteAn inline directive in the implementation but not in the interface should be rejected by the compiler, because it changes the interface crc. I know it does not do that currently, but that is a compiler bug. ---------------------------------------------------------------------- engkin · 2021-02-15 04:34 Quote from: Martin_fr on February 15, 2021, 04:48:27 amprobably related: https://bugs.freepascal.org/view.php?id=35346#c115730 QuoteAn inline directive in the implementation but not in the interface should be rejected by the compiler, because it changes the interface crc. I know it does not do that currently, but that is a compiler bug. I just tried moving the inline directive to the interface, no change. Tried adding it to both, also no change. To get the change reflected I have to delete BUnit's object and ppu files.Despite the fact that the change is in unit AUnit. ---------------------------------------------------------------------- Martin_fr · 2021-02-15 17:34 Well it probably is a bug. You can use ppudump. AUnit.ppu will not change its checksum. Bunit.pas is not changed, and due to the checksum it assumes AUnit unchanged, and so Bunit does not recompile. But I do not know the full story of the checksums. The above would mean that we get tons of errors, because if that was all, then inline would cause tons of errors. So I may be missing something. If you are looking if someone can reproduce. Yes I can. But I am using fpc 3.0.4 ---------------------------------------------------------------------- ASerge · 2021-02-15 21:05 I tried to put the program into a new project manually (in Lazarus). Until I saved the files, everything worked fine. No matter how I changed, the changes compiled into the correct output. But as soon as I saved the project files and tried to change inlined_function, the bug showed up. ---------------------------------------------------------------------- Martin_fr · 2021-02-15 21:38 I compiled from commandline. (1st and 2nd compile) Output of the 2nd compile: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i fpc.exe prInlineBug.lprFree Pascal Compiler version 3.2.0 [2020/06/21] for x86_64Copyright (c) 1993-2020 by Florian Klaempfl and othersTarget OS: Win64 for x64Compiling prInlineBug.lprCompiling aunit.pasLinking prInlineBug.exe39 lines compiled, 0.2 sec, 167088 bytes code, 9508 bytes data  And the code did not update the result. This behaviour is also present if I add AUnit to the uses of the lpr file. It also seems unaffected by the BUnit using AUnit in Interface or Implementation. And it seems (only tested one of the above scenarios) to happen with a recent (Jan 21) 3.3.1 ---------------------------------------------------------------------- Martin_fr · 2021-02-15 21:40 Quote from: ASerge on February 15, 2021, 10:05:35 pmI tried to put the program into a new project manually (in Lazarus). Until I saved the files, everything worked fine. No matter how I changed, the changes compiled into the correct output. But as soon as I saved the project files and tried to change inlined_function, the bug showed up. When you have not yet saved your project, the IDE saves files in a temp dir. I do not know, but maybe all files are saved each time (changing timestamps, and forcing recompile).