Re: gdb-patches RFA: Fix pascal behavior for class fields

Waldek Hebisch <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
> Pierre Muller wrote:
> > 
> > It compiles if you put a 'program' statement at the beginning, and
> > change a.check(b) to assign the function result,
>   I tried this,
> but here is what I get after your changes:
> $ gpc  test-class-pascal.pas
> test-class-pascal.pas:4: error: undeclared identifier `class' (first use in
> this routine)
> test-class-pascal.pas:4: error:  (Each undeclared identifier is reported
> only once
> test-class-pascal.pas:4: error:  for each routine it appears in.)
> test-class-pascal.pas:6: error: undeclared identifier `x' (first use in this
> routine)
> test-class-pascal.pas:6: error: syntax error before `,'
> 
> Pierre@d620-muller ~/pas/test
> $ gpc --version
> gpc 20050331, based on gcc-3.4.4 (cygming special, gdc 0.12, using dmd
> 0.125)
> Copyright (C) 2005 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> Is it because I am using version 3.4.4?

gcc version is not a problem.  But your gpc is too old: classes are
supported starting from gpc-20051104 (the next version after the one
you tried).

> The problem is that I did not find any system 
> with easy installation of GPC,

AFAICS old Debian binaries should work on new systems.  In 2012
Peter Blackman generated Debian/Ubuntu package (IIRC it was
at launchpad).

>  Anyhow, by using objects instead of classes, I was able to compile the
> modified program,
> and it turns out that GPC is using 'Self' for the hidden 
> object name for stabs debugging, so that the problem probably does not apply
> to
> GPC compiled sources.
> 

Classes are transformed by GPC into pointers to objects, so
there is small difference.  Attacheched is assembler output
from gpc-20070904 using '-fextended-syntax -gstabs -O -S'
as options.

-- 
                              Waldek Hebisch
[email protected]

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
test-class-pascal.s (application/octet-stream, 10 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.