(Subject is just kidding, just wanted to warn you, I stumbled onto this
when I threw "Pascal" into Savannah's search engine) :-)
GPC= Guile Pascal Compiler, and is hosted on GNU Savannah :-)
http://savannah.gnu.org/projects/gpc/
Hi,
I've uploaded a new GPC snapshot to
http://gnu-pascal.de/alpha/
I've labelled this alpha, though it's probably not less stable than
GPC 2.1, but I've done less thorough testing than with 2.1 and the
betas.
It contains mostly minor changes that have accumulated since May, no
big news.
This is the list of new features since 2.1:
@item new built-in procedure @samp{Assert}; new switches @samp{--[no]-assert} (also @samp{@{$C+@}}, @samp{@{$C-@}} for Delphi compatibility) (fjf665*.pas) (D)
@…
[View More]item new function @samp{ProcessGroup}
@item StringUtils: new function @samp{QuoteEnum}
@item new built-in constants @samp{GPC_Function}, @samp{GPC_PrettyFunction}
@item TFDD: new unit
@item gpc-run: new options @samp{-e FILE} and @samp{-E FILE} (redirect/append standard error)
Bugs fixed:
@item 20020904: comparisons between signed and unsigned integers sometimes give wrong results (eike2.pas, fjf664.pas)
@item 20020903: @samp{IOSelect} fails with file handles >= 8 on some systems (e.g., Solaris) (fjf663.pas)
@item 20020831: GPC creates wrong debug info for many built-in types <200208280012.g7S0CWj07637@@mail.bcpl.net>
@item 20020827: comparisons of @samp{packed} subrange variables don't work right (martin4[ab].pas)
@item 20020824: operators defined in units don't always work (maur11.pas)
@item 20020824: object methods that contain an ISO style procedural argument forget the implicit @samp{with Self do} (fjf662a.pas)
@item 20020615: @samp{if Pass[i] in 'A'..'Z'} makes GPC crash (miklos6.pas)
@item 20020603: compiling a program (not a unit or module) with @samp{--interface-only} or @samp{--syntax-only} segfaults (waldek1.pas)
@item 20020603: @samp{--nested-comments} fails without @samp{-Wall} (waldek2.pas)
@item 20020514: spurious warning with @samp{for} loops using a @samp{ByteCard} counter (toby1.pas)
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
[View Less]
> Nick Ioffe wrote:
>
> > I declare public variables in module interface and then
> > try to use them.
> >
> > The problem is that while integer variables work perfectly
> > all other kinds of variables (at least files and strings)
> > don't work at all.
> >
> > May somebody explain me what is going on?
> > Why integer is defined ok, but string has problem?
>
> It's a known problem:
>
> : the capacity of strings …
[View More]declared in interfaces of modules is not
> : initialized (daj3.pas, sven14c.pas, nick1.pas)
>
> Actually, it affects those types that require some automatic
> initialization which are schemata (including strings), files and
> objects.
>
> It only happens with modules, not with units. I'll try to fix it
> when I get to it, but it's not trivial and will require some other
> cleaning up of the module mechanism ...
>
> Frank
>
Hi! Thank you for all your responses. I'm sorry for bringing back
the known problem.
Here're 2 more strange behaviours with interface vs. implementation
global variables definitions. May be they will help you to find out
what is wrong in modules initialization.
Problem I:
I slightly change the previous expample - declare my_str_var in both
mod1 module interface and implementation, in mod2 implementation
and in my_main global var definitions block.
What happens is that although each variable should be local for the module
(at least that is what the common sense tells me) all the variables
behave like there're the same variable.
I've checked it with debugger and it points to the same address in all modules.
the source is as follows:
---------------mod1.pas-------------------
module mod1 interface;
export mod1 = all;
Type
mystr = string(7);
Var
my_str_var : mystr;
procedure mSet (str_arg : mystr);
end.
module mod1 implementation;
Var
my_str_var : mystr;
procedure mSet (str_arg : mystr);
begin
writeln ('mod1 mset str_arg:',str_arg,'.');
my_str_var := str_arg;
writeln ('mod1 mset my_str_var:',my_str_var,'.');
end;
end.
---------------mod2.pas--------------------
module mod2 interface
export mod2 = all;
import mod1;
procedure sSet (str_arg : mystr);
function sGet : mystr;
end.
module mod2 implementation;
import mod1
Var
my_str_var : mystr;
procedure sSet (str_arg : mystr);
begin
writeln ('mod2 sset str_arg:',str_arg,'.');
my_str_var := str_arg;
writeln ('mod2 sset my_str_var:',my_str_var,'.');
end;
function sGet : mystr;
begin
sGet := my_str_var;
end;
end.
-----------------------my_main.pas-------------------
program my_main (input,output);
import mod1;
import mod2;
Var
another_str : mystr := '7654321';
my_str_var : mystr;
begin
sSet ('0123456');
writeln ('1. my_main another_str:',another_str,'.');
another_str := sGet;
writeln ('2. my_main another_str:',another_str,'.');
my_Str_var := 'abcdefg';
another_str := sGet;
writeln ('2. my_main another_str:',another_str,'.');
mSet ('nick io');
another_str := sGet;
writeln ('2. my_main another_str:',another_str,'.');
end.
--------------------------------------------------------
The run results are:
mod2 sset str_arg:0123456.
mod2 sset my_str_var:0123456.
1. my_main another_str:7654321.
2. my_main another_str:0123456.
3. my_main another_str:abcdefg.
mod2 sset str_arg:nick io.
mod2 sset my_str_var:nick io.
4. my_main another_str:nick io.
=============================================================
Problem II.
As we've seen in problem I repeating the declaration in module
implementation solves the problem of accessing the strings.
Now I need to declare the array of string:
-----------------mod3_1.pas-------------------------
module mod3 interface;
export mod3 = all;
Var
my_buff : array [1..10] of String(80);
procedure pBuff;
end.
module mod3 implementation;
Var
my_buff : array [1..10] of String(80);
procedure pbuff;
var int ii;
begin
for ii:=1 to 10 do
writeln (my_buff[ii]);
end;
end.
------------------------------------------------
When I compile it I get the following errors:
mod3.pas:15: redeclaration of 'My_buff'
mod3.pas:10: previous declaration of 'Mybuff'
then I change the source as follows:
-----------------mod3_2.pas-------------------------
module mod3 interface;
export mod3 = all;
Type
my_buff_type = array [1..10] of String(80);
Var
my_buff : my_buff_type;
procedure pBuff;
end.
module mod3 implementation;
Var
my_buff : my_buff_type;
procedure pbuff;
var int ii;
begin
for ii:=1 to 10 do
writeln (my_buff[ii]);
end;
end.
------------------------------------------------
Now everything compiles good.
Why? What is the difference?
Sincerely,
Nick
[View Less]
Hi Folks!
I don't know whether it's a feature or a bug, I didn't find it
on the list of known bugs so here is my report:
Comparisions between Cardinal and Integer may fail, if the Integer
value is negative.
Version:
2.1 (20020510), based on gcc-2.95.2 19991024 (release)
program testcase;
var
aCard: Cardinal;
aInt: Integer;
begin
aCard := 1;
aInt := -1;
{ "FAIL" }
if (aCard > aInt) then
WriteLn ('OK')
else
WriteLn ('FAIL');
{ "FAIL" }
if (aCard > -1) …
[View More]then
WriteLn ('OK')
else
WriteLn ('FAIL');
{ just for completness: "OK" }
if (1 > -1) then
WriteLn ('OK')
else
WriteLn ('FAIL')
end.
BTW: The gcc C fontend does the same.
Eike
[View Less]
Hi!
I've encountered some strange problem using GPC built from may
on HPuix 11.00.
I declare public variables in module interface and then
try to use them.
The problem is that while integer variables work perfectly
all other kinds of variables (at least files and strings)
don't work at all.
See the following small modules:
---------------mod1.pas-------------------
module mod1 interface;
export mod1 = all;
Type
mystr = string(7);
Var
my_str_var : mystr;
my_int_var : integer;
…
[View More]end.
module mod1 implementation;
to begin do
writeln ('Load mod1');
end.
---------------mod2.pas--------------------
module mod2 interface
export mod2 = all;
import mod1;
procedure sSet (str_arg : mystr);
function sGet : mystr;
procedure iSet (int_arg : integer);
procedure iGet : integer;
end.
module mod2 implementation;
import mod1
procedure sSet (str_arg : mystr);
begin
writeln ('mod2 sset str_arg:',str_arg,'.');
my_str_var := str_arg;
writeln ('mod2 sset my_str_var:',my_str_var,'.');
end;
procedure iSet (int_arg : integer);
begin
writeln ('mod2 sset int_arg:',int_arg,'.');
my_int_var := int_arg;
writeln ('mod2 sset my_int_var:',my_int_var,'.');
end;
function sGet : mystr;
begin
sGet := my_str_var;
end;
function iGet : integer;
begin
iGet := my_int_var;
end;
end.
-----------------------my_main.pas-------------------
program my_main (input,output);
import mod1;
import mod2;
Var
another_str : mystr := '7654321';
another_int : integer := 361;
begin
sSet ('0123456');
writeln ('1. my_main another_str:',another_str,'.');
another_str := sGet;
writeln ('2. my_main another_str:',another_str,'.');
iSet (19);
writeln ('1. my_main another_int:',another_int,'.');
another_int := iGet;
writeln ('2. my_main another_int:',another_int,'.');
end.
--------------------------------------------------------
Well, after I compile all 3 files and run the my_main what I get is:
mod2 sset str_arg:0123456.
mod2 sset my_str_var:.
1. my_main another_str:7654321.
2. my_main another_str:.
mod2 iset int_arg:19.
mod2 iset my_int_var:19.
1. my_main another_int:361.
2. my_main another_int:19.
After I copied the my_str_var definition to implementation as well
I get the following result:
mod2 sset str_arg:0123456.
mod2 sset my_str_var:0123456.
1. my_main another_str:7654321.
2. my_main another_str:0123456.
mod2 iset int_arg:19.
mod2 iset my_int_var:19.
1. my_main another_int:361.
2. my_main another_int:19.
The strange is that after I moved my_str_var definition from
mod1 implementation to my_main var definitions nothing changed.
May somebody explain me what is going on?
Why integer is defined ok, but string has problem?
BTW as I stated earlier I have problem similar to string problem
with File variables and any structures containing string fields.
Thank you in advance.
P.S.
If the example doesn't compile - it is because of typos.
I run GPC on system which is not connected to Internet, and
the Internet computer doesn't have floppy.
P.P.S
I'd like to thank all of you who'd found out the problem with
debuger.
Nick
[View Less]
When debugging GPC 2.1 programs with GDB, I am unable to print the values
of variables that are of the "standard" types. Variables of user-defined
types appear to print OK. I am using the Chief's "i486-mingw32" port from:
http://www.gnu-pascal.de/contrib/chief/win32/mingw32/
...but I have observed the same problem in a Mingw version that I built
myself.
Test case:
program gdbtest (output);
var i : integer;
r : real;
c : char;
e : (enum1, enum2);
…
[View More]s : 0..10;
t : string (12);
begin
i := 3;
r := 3.14159;
c := 'Q';
e := enum2;
s := 4;
t := 'test string';
writeln (i, r, c, s, t);
end.
To reproduce:
D:\>gpc -v
Reading specs from /mingw/lib/gcc-lib/mingw32/2.95.3-6/specs
gpc version 2.1 (20020510), based on 2.95.3-6 (mingw special)
D:\>gpc -o gdbtest.exe -g gdbtest.pas
D:\>gdb gdbtest.exe
GNU gdb 5.1.1 (mingw experimental)
Copyright 2002 Free Software Foundation, Inc.
[...]
This GDB was configured as "mingw32"...
(gdb) b gdbtest.pas:18
Breakpoint 1 at $4012c2: file gdbtest.pas, line 18.
(gdb) r
Starting program: D:/gdbtest.exe
Breakpoint 1, pascal_main_program () at gdbtest.pas:18
18 writeln (i, r, c, s, t);
(gdb) p i
$1 = void
(gdb) p r
$2 = void
(gdb) p c
$3 = void
(gdb) p e
$4 = Enum2
(gdb) p s
$5 = 4
(gdb) p t
$6 = 'test string'
(gdb) c
Continuing.
[program prints "3 3.141590000000000e+00Q4test string" as expected]
Note that the first three variables (of standard types "Integer", "Real",
and "Char") print void values in the debugger. I have also tried this with
GDB 4.18 and observe the same problem.
Could someone please confirm whether these results are reproducible across
platforms or are specific to the ix86-mingw32 platform? Thanks!
-- Dave Bryan
[View Less]
Hi,
Re. Nick Ioffe's problem with global file and string definitions at module level not being visible, I have been having to work around that problem for some years with my Linux gpc installation (by using local definitions).
Regards
David Wood, QinetiQ Farnborough.
The Information contained in this E-Mail and any subsequent correspondence
is private and is intended solely for the intended recipient(s).
For those other than the recipient any disclosure, copying, distribution,
or any action …
[View More]taken or omitted to be taken in reliance on such information
is prohibited and may be unlawful.
[View Less]
Currently gpc with GCC 3.1.1 is getting almost useable. Remaining
problems:
-- DWARF2 routines in GCC can not handle FILES and abort
the compiler (however a null program do compile with
debugging on)
-- not all data used by front end is properly marked, and
compiler may crash after garbage collection.
-- with garbage collection disabled it passes most tests,
7 are skipped and 14 fails.
-- exponentiation is unimplemented (gcc-3.1.1 has no EXPON_EXPR).
one should probably …
[View More]copy code from g77, but since none
of the test needed exponentiation I just postponed it.
At least 3 of failing tests (ian5a.pas, ian5b.pas, fjf73.pas)
look like bugs already present in the current version -- they
fail in tree checks, I wonder if anybody run the tests with
tree checks in compiler enabled?
Frank: how can I get your recent changes? I began to clean
my changes and want to send a patch in few days.
--
Waldek Hebisch
hebisch(a)math.uni.wroc.pl or hebisch(a)hera.math.uni.wroc.pl
[View Less]
When the DOS unit (and strangely only the DOS unit)
is used both in a program and an unit used by this program,
all the interface is flagged as redefined and compilation fails.
This happens only with the Mingwin version,
DJGPP and Linux version are OK (but they are older)
Here is a test:
a programm and a unit
Note that the unit DOS is not actually used.
********************************
program testinc;
uses dos,unitinut;
begin
writeln(affichage);
end.
**********************************
unit …
[View More]unitinut;
interface
var
affichage:string;
implementation
uses dos;
begin
affichage:="affiche";
end.
***********************************
--
Jean-Pierre Vial
[View Less]