On 7 Nov 2001, at 17:00, Shafiek Rasdien wrote:
In my attempt to compile the p4 interpreter, I came across the following.
Please note the new list address address: gpc@gnu.de. Also, when reporting problems with GPC, please give your GPC version and platform. Perhaps the easiest way to do this is to report the result of:
gpc -v
e.g.:
Reading specs from D:\Programming\Pascal\i486-pc-mingw32msvc\2.95.3\specs gpc version 20010604, based on 2.95.3 20010315 (release)
The program
################################# program pcode; label 1; begin end.
###################################
yields
test.p: In function `program_Pcode': test.p:2: label `1' used but not defined
causing a compile time error. Should this not be a warning.
The wording is perhaps confusing, but it is an error. From the ISO 10206 Extended Pascal Standard (and ISO 7185 Standard Pascal also):
6.2.1 Blocks
A block closestcontaining a labeldeclarationpart in which a label occurs shall closestcontain exactly one statement in which that label occurs.
In other words, an "unused label" is not permitted, because once declared, a statement must exist that uses that label.
The error message has "used" as meaning "used in a label declaration" and "defined" as meaning "defining the location of the label." Perhaps:
label '1' declared but not used
or
label '1' declared but not defined
...would be clearer?
Also
#################################### program pcode (output); label 1;
procedure asm; begin 1: end; { asm }
begin 1: end. ######################################
Should say "Multiple label `1' instances"....
"asm" is a GPC keyword, and with gpc-20010604, I get:
pcode.pas:4: parse error before `Asm'
If I use:
gpc -c --extended-pascal pcode.pas
...to eliminate the GPC keyword extensions, I get:
pcode.pas: In main program: pcode.pas:10: duplicate label `1'
-- Dave