Objects Bug_(re)
Sat, 9 Aug 1997 13:33:59 +0200 (MEST)
Hello, again!
According to Bernhard Tschirren:
>
> After hours of frigging around with HUGE test programs, I accidentally
> stumbled on a stupidly simple test program! Even better - it crashes the
> compiler! I only hope that you can reproduce the bug.
I just fixed it. :-)
The problem was that methods get an implicit `Var' parameter called `Self',
so they need a pointer to the object be defined. Some centuries ago, I
told GPC to define `ptr_to_Myobject = ^MyObject' implicitly (with the first
casing being as written, i.e. inaccessible for the user program), so this
did work in a program. What I had forgotten was to *export* `ptr_to_Myobject'
if this was done in a Unit or Module.
Diff follows. A new GPC beta will follow soon. (Some things in the run
time library have to stabilize first.) For the impatient: I am uploading
the current "state of the art" as a sequence of gzipped diffs to
ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/beta/ (without further
comment).
Thanks for the nice test program,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
maintainer GNU Pascal [970714] - http://home.pages.de/~gnu-pascal/ [970125]
8< ---------------------------------------------------------------------------
--- ../../gpc-970806/p/util.c Wed Aug 6 14:47:15 1997
+++ util.c Sat Aug 9 13:39:50 1997
@@ -1526,8 +1526,7 @@
void
check_object_pointer ()
{
- tree p, ptr = NULL_TREE, d, ptr_name_node;
- char ptr_name [256];
+ tree p, ptr = NULL_TREE;
/* In most practical cases the user program will have
* explicitely specified a pointer type pointing to the
@@ -1549,6 +1548,9 @@
*/
if (!ptr && current_type_name)
{
+ tree d, ptr_name_node;
+ char *ptr_name = xmalloc (IDENTIFIER_LENGTH (current_type_name)
+ + strlen ("ptr_to_") + 8);
sprintf (ptr_name, "ptr_to_%s", IDENTIFIER_POINTER (current_type_name));
ptr = build_pascal_pointer_type (current_type_name);
ptr_name_node = get_identifier (ptr_name);
@@ -1558,6 +1560,9 @@
finish_decl (d, NULL_TREE, NULL_TREE);
current_type_list = chainon (current_type_list,
build_tree_list (NULL_TREE, ptr_name_node ));
+ if (this_is_an_interface_module)
+ handle_autoexport (ptr_name_node);
+ free (ptr_name);
}
}
Peter Gerwinski (peter@agnes.dida.physik.NO-SPAM-PLEASE.de)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es