>Could be a bug in the compiler?
Seems so. What version of compiler you are using? Note: FreePascal code was tested with 1.9.2 version of compiler.