Mattias Gaertner wrote 9 lines
On Sat, 17 Feb 2018 22:35:17 -0500
Donald Ziesig via Lazarus wrote:
> [...]
> Isolated it to FPC. Ran fpc from terminal without IDE. Got same error
> (AV). It is getting late here. I will look at this in the morning.
Maybe you got messed up ppu files, or you messed up unit paths.
Mattias
I found the problem! It is definitely a compiler bug (compiler did NOT report the actual error, all it did was throw an Access Violation).
Unfortunately, I had changed one more line than I remembered during the last edit before the failure.
That line was (in the type(s) declaration:
TAMBytes = array[0..1] of Byte;
I changed it to:
TAMBytes = array[0..High(Integer)] of Byte;
Type TAMBytes was used as the return type is several functions. When I commented out ALL of the code that used TAMBytes, the error went away. Since TAMBytes was the only consistent item in that code, I checked its declaration and remembered the other :-[ change I made. Reverted that to the original version and the compilation succeeded. Finally changed it to:
TAMBytes = array[0..32767] of Byte;
This also compiled successfully, and was big enough that it will handle much bigger arrays than I expected to use.
I will create a simplified test case and submit a bug report to Free Pascal.
Thanks for putting up with my earlier complaints.
Don Ziesig