Scott Moore wrote:
My name is Scott A. Moore, I am the person who performed some of the ISO 7185 compliance testing on GPC. I have done a minor update to some of my ISO 7185 compliance testing material, and reran this against the current version of GPC (2.95). In the process, I have discovered a compliance problem with GPC.
BTW, 2.95 is the backend (GCC) version number. For Pascal-level reports (as opposed to code-generation issues), usually the GPC version number is more important. `gpc -v' will tell both. But in this case, I think it applies to all recent GPC versions, anyway ...
The second section of the test verifies that eoln is automatically inserted at the end of a text file if it was terminated without a eoln. See ISO 7185 section 6.4.3.5:
Basically, the rules say that a text file shall consist of either whole lines, or be entirely empty. Whole lines are defined as "~S(end of line)", or a series of arbitrary characters terminated by end of line.
In effect, the program processor must arrange for eoln to be true at the end of a file, either by faking it while reading, or by forcing an eoln to be written at the end of a file during generation.
(BTW, I'm not even sure if the latter would be sufficient, since the condition then wouldn't be satisfied for files written in other ways.)
Well, first I must say that this is a point where I consider the standard broken. (E.g., I have a text editor written in Pascal, and I want it to be able to handle files with or without trailing EOLn's, without appending them either when reading or writing the files.)
So I've fixed it now, but only in the standard Pascal modes (`--classic-pascal', `--extended-pascal'). Though usually we try to avoid changing the behaviour based on the dialect options (only restrict extensions), there are some cases where this seems preferable (such as default width for writing Booleans, or no compile-time error for division by zero) ...
I'm not attaching a patch here, since it requires changes spread over several source files which might conflict with other changes I've made meanwhile. But it will be ok in the next GPC release.
If you don't mind, I'll put your test program in the test suite for regression testing (scott1.pas, with `{$classic-pascal}' inserted).
Frank