It can also be caused when external libraries allocate memory for - which is usually documented - Freepascal is supposed to free it.
In that case the compiler can not show line numbers, because the external library is not compiled with lineinfo.
The way to test this is simply to write a simple pascal program in which some pascal allocated memory is intentionally not free'd. If that simple program
does not show line numbers, there is a bug in external code, but you should be able to free the memory. If it does show line numbers, it is probably as I described.
If it
does not show line numbers it is a bug in FPC or Lazarus.
Try something like this and compile without optimization:
{$mode objfpc}
var a:TObject;
begin
a:=TObject.Create;
end.
If that does show a line number then an external library is the cause of your problem. My Mac died long ago, so can not test this.
Also note it can be an external dependency you are not aware of because it is provided by the OS.
The output should be like this: