compiler bug
CBFalconer
cbfalconer at yahoo.com
Fri Oct 12 20:38:14 CEST 2001
"J. David Bryan" wrote:
>
> On 11 Oct 2001, at 18:59, CBFalconer wrote:
>
... snip ...
>
> I believe that generally it would be most helpful to the GPC maintainers if
> you could separate into the smallest complete programs each of the missed
> syntax errors you noted (i.e., create the smallest possible test case for
> each reported problem). For example, the first error appears to be caused
> by an out-of-order declaration, so:
>
> program t1;
>
> procedure p;
> begin
> end;
>
> var x: integer;
>
> begin
> end.
>
> ...should do it. Your help in improving the quality of GPC will be
> appreciated.
Your sample above has two faults. It should specify at least
(output) in the command line, and it has the illegal declaration
portion. Both of which are minor, but contrary to strict
standards. PascalP has a flag to allow some of the out-of-order
declarations. So:
PROGRAM testnn1;
BEGIN
writeln('Testnn fails to detect lack of output file parameter');
(* here is needed a way to return a status *)
(* which is missing from ISO Pascal *)
(* PascalP uses "terminate(integer)" extension *)
END.
PROGRAM testnn2(output);
CONST
a = 1;
TYPE
b = integer;
CONST
c = 2;
BEGIN
writeln('Failure to detect misordered declarations');
END.
and variations on the above. There should be a numbering scheme
tying the tests to sections in the standard (which I don't have
anymore) and to identify the standard involved. You seem to have
multiple levels, 0, 1, extended, and others which have no
published standard.
One that I put up on pascal.misc a while ago:
PROGRAM testnn3(output);
CONST
mini = 32765;
maxi = 32767;
TYPE
ix = mini..maxi;
VAR
i : ix;
BEGIN
FOR i := mini TO 32770 DO write(i : 8);
writeln;
writeln('Failed to detect out of range index');
writeln('Should probably fail at compile time');
END.
and another oldie is a for loop up to maxint
FOR i :- maxint-5 TO maxint DO write(i : 10);
which becomes an infinite loop on some systems.
I can prepare a few sample tests after I get more familiar with
the package.
How do I turn on range-checking? It appears to be missing by
default, and a search of the manual via 'info' turns up nothing.
I got the command line version to default by running it through an
alias. rhide doesn't seem to call it through the command
processor, so this doesn't affect it, and so far I have found no
way to set that default.
I get the impression that GPC encompasses the full GCC
functionality. Is this correct? Is the idea to eventually
include it in GCC rather than as a separate package.
>
> The cleanest way to default GPC to one particular standard would have been
> to modify the "specs" file, specifically, the "*gpc1" entry. I say "would
> have been" because although GPC correctly reads the specs file and
> processes most of the entries found therein, no substitution is performed
> for the "*gpc1" spec, even though a substitution parameter is defined for
> this purpose.
>
> I have a patch for "lang-specs.h" at home, which I've been using for this
> purpose. I'll send it to the list this weekend.
Does that involve recompiling GPC - it sounds it and I am not
really prepared to do that under DJGPP. I am operating on 7 year
old hardware, and the CDROM is flakey, so I have not found a way
to mount Linux yet.
>
> > Just the fact that this thread ever started is worrysome. I could
> > see it in C, but Pascal is supposed to prevent such things.
>
> I'm not certain that I understand your point here. The original poster
> correctly identified a bug in the compiler, and the test case provided was
> legal "GNU Pascal" (and legal Extended Pascal too). What specifically is
> worrisome about this bug report?
I really meant this sub-thread. Bug is one thing, but the fact
that, even with the standard flag, it fails to flag various errors
is my concern. Where is your test suite available?
I have persuaded Netscape to isolate the gpc list traffic, however
replies do not default to the list, but to the originator. I
assume traffic such as this should go through the list.
--
Chuck F (cbfalconer at yahoo.com) (cbfalconer at XXXXworldnet.att.net)
(Remove "XXXX" from reply address. yahoo works unmodified)
mailto:uce at ftc.gov (for spambots to harvest)
More information about the Gpc
mailing list