internal error 2014062901 lazarus / 64-FPC development ---------------------------------------------------------------------- engkin · 2021-10-03 06:24 The following code produces an internal error on Mac Big Sur M1 using trunk: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+} function bug(s: string): string;var  p:pointer=@s;//internal error 2014062901beginend; beginend. Can you please check different OS/FPC version before I report it? ---------------------------------------------------------------------- bytebites · 2021-10-03 06:44 Same result on Linux 3.2 and trunk Do you expect this result, which prints true Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function bug(s: string): string;var  //p:pointer=@s;//internal error 2014062901  p:pointer absolute s;begin  writeln(string(p));  writeln(pchar(s)=p);end; ---------------------------------------------------------------------- engkin · 2021-10-03 06:59 Thank you for testing. Yes, I do expect True in this case. The record holding the length, ref count, code page ... is at a negative offset of s. Or did I miss your point? ---------------------------------------------------------------------- bytebites · 2021-10-03 07:32 Length like so Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   writeln(PSizeInt(p-sizeof(sizeint))^=length(s)); ---------------------------------------------------------------------- Jonas Maebe · 2021-10-03 13:05 While it shouldn't cause an internal error, it is an invalid expression. The reason is that @s is not constant (it's the address on the stack of the ansistring, which can be different every time the function gets called). At least FPC has no support for initialising variables with non-constant expressions. ---------------------------------------------------------------------- engkin · 2021-10-03 17:52 Yes, it is a faulty code. Just the internal error should not happen. Reported as issue #39393