I have uploaded a new alpha version of GPC to
<http://www.gnu-pascal.de/alpha/>.
Important notes:
- This is an ALPHA version, as discussed on the mailing list before.
Not so many extensive tests have been made (though the test suite
passes on my system). I'm not uploading binaries, diffs, separate
test suite archives, updated web pages etc., just the source
distribution. (Of course, others may feel free to upload binaries
for various platforms.) I'm not aware of any serious bugs, but you
have to decide for yourself whether to use it for production work.
- Bison (building GPC)
Bison version 2.0 has been released. It can be obtained at
<ftp://ftp.gnu.org/gnu/bison/bison-2.0.tar.gz>. This is now the
recommended version for all GPC compilations. Fortunately, we now
don't depend on changing alpha/beta versions of bison anymore.
Bison is required when building a minimal distribution of GPC
(which now doesn't include the Bison generated files anymore, as
it did temporarily); when building a full source distribution and
not modifying the bison input files (*.y), bison is not strictly
needed, but in case of doubt, it can't hurt to install the new
bison version.
New features:
- Support for gcc-3.4.x (tested with 3.4.3)
The caveats that apply to gcc-3.3.x (especially on Dos/Windows)
also apply here.
- Renamed options
Due to the way that gcc-3.4.x handles options, we had to rename
two options (command line and compiler directive, respectively).
To avoid confusion, we did this for all backend versions:
--no-default-paths -> --disable-default-paths
--no-debug-info -> --disable-debug-info
Note: `--disable-debug-info' is only used in very special cases,
and usually as a compiler directive. To turn off debug info one
would normally use `-g0' which remains unaffected.
- Qualified identifiers
(chief18.pas, fjf260*.pas, fjf921*.pas, grp1.pas, kurzw1.pas,
mod{9,10,13..17}*.pas)
GPC now supports qualified identifiers, both Extended Pascal and
Borland Pascal style.
A small incompatibility to previous versions arises when a
declaration has the same name as an interface, which is not EP
conformant, but GPC previously allowed. This will now cause
compile-time errors. The solution is to rename either the
interface or the declaration.
The linker names, if not specified explicitly, are now completely
different. Since those linker names should not be relied upon
anyway, we hope this is no problem. If you get problems here, just
add `name' attributes where necesssary. (This will also make the
code more robust, in case the internal conventions ever change
again.)
- Importing within a routine (EP feature) works now.
(mod15[c-e].pas)
- Range checking
(chuck5.pas, fjf446.pas, fjf989*.pas, fjf992*.pas, fsc{01..37}*.pas,
miklos1[bc].pas, mir{016,021..028,030..047}*.pas, russ4*.pas)
GPC now supports full range checking (previously it did so only
for dynamic ranges and sets). Range checking is on by default (in
all dialects) and can be turned off and on again by command-line
arguments or compiler directives (`{$[no-]range-checking}' and
also `{$R-}' and `{$R+}', BP compatible).
Note, this is not overflow checking, which may be implemented
later and will be a separate option, just like in BP. Range
checking applies when a value of a larger type (e.g., an `Integer'
variable or the result of an integer operation) is used in a place
where a subrange is expected (e.g., an array index, or assignment
to a variable with more limited range). Overflow checking would
apply if the result of an arithmetic or other operation exceeds
the representable values (e.g., `var a: Integer = MaxInt; [...]
WriteLn (a + a)'). This is not yet checked.
For input operations (`Read', `ReadLn', `ReadStr', `Val'), range
checking errors are treated as I/O errors, so they can be trapped
with `{$I-}' via `IOResult' (for `Read*'), or for `Val' via the
3rd parameter (while range errors in the 3rd parameter of `Val'
itself are treated as regular runtime errors; this paramter is the
error position, so range errors there can be avoided simply by
declaring it of a sufficiently larger type, usually just `Integer'
or `Cardinal').
For strings, range checking is BP compatible (access up to the
capacity allowed) in `--borland-pascal' and `--delphi' modes and
EP compatible (access only up to the current length allowed)
otherwise. So in default (EP) mode code such as
if MyString[1] = '-' ...
without a check
if (MyString <> '') and ...
may now fail with a range-checking error. This is useful, since
the first test was always undefined if `MyString' was empty, but
in my experience so far, this has been one of the most common
causes of range-checking errors in my code.
The same applies with `var' parameters and the address operator as
well, so e.g. code such as:
BlockRead (f, StringLength, SizeOf (StringLength));
BlockRead (f, s[1], StringLength);
SetLength (s, StringLength);
needs two changes to be range safe now:
BlockRead (f, StringLength, SizeOf (StringLength));
SetLength (s, StringLength);
if StringLength > 0 then BlockRead (f, s[1], StringLength);
Another example (rather low-level code, found e.g. in the RTS):
BufPtr := PChars0 (@s[1]);
BufSize := Length (s);
will fail if `s' is empty. Possible change (provided the using
code doesn't access `BufPtr' if `BufSize' is empty, which would be
undefined anyway when reading):
if s = '' then
BufPtr := nil
else
BufPtr := PChars0 (@s[1]);
BufSize := Length (s);
- `pow', `Trim', `Card', set operations (`-', `*', `><'), set
comparisons, string comparisons and array slices with constant
arguments can now be used in constants (fjf998*.pas, fjf1000*.pas,
fjf1009*.pas)
- Initialized types in record and object fields and in schemata work
now. (inirec[24].pas, fjf1016*.pas)
- Types and initializers containing variable expressions, including
schemata with non-constant discriminants work now.
(couper[45].pas, fjf186.pas, fjf548.pas, fjf612a.pas, fjf997*.pas,
fjf1003*.pas, john1a.pas)
- With `-Wnested-comments' and without `--nested-comments' warn
about comment openers found within comments. (fjf1017*.pas)
- New options `--[no-]case-value-checking' (fjf1012*.pas)
- Arithmetics with a complex and a real operand
are now better optimized.
(<20020118143553.B28837(a)artax.karlin.mff.cuni.cz>)
- Bug fixes:
* warn if an lhs cast decreases alignment (avo9.pas)
* don't require result variables in forward declarations except in
strict ISO mode (marku10*.pas)
* writing to a file buffer at EOF didn't work (eof1.pas)
* don't allow `f^' for unopened files `f' (pcerror[ij].pas)
* evaluate initializers exactly as often as specified
(fjf1019.pas)
* in standard Pascal modes, `EOF' is false on an empty file
(tom7.pas)
* wrong `arithmetical overflow' with `set of byte' (igor1.pas)
* `ParamStr' evaluated its argument twice (fjf963b.pas)
* user-defined operators must not be applied to implicit
operations (fjf991.pas and many other cases)
Frank
--
Frank Heckenbach, frank(a)g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
http://www.gnu-pascal.de/todo.html
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8