This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
bugs in toy compiler
- To: Tim Josling <tej at melbpc dot org dot au>
- Subject: bugs in toy compiler
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Sat, 20 Jan 2001 03:18:37 +1100
- Cc: gcc at gcc dot gnu dot org
- References: <20001125170002.A29469@hg.cs.mu.oz.au> <3A1FA8B5.50FEE85E@melbpc.org.au> <20001224034943.A30336@hg.cs.mu.oz.au> <3A450BCE.2F372ADB@melbpc.org.au>
There's a nasty bug in toy.c.
It needs the following lines
ggc_add_tree_root (&signed_and_unsigned_types[0][0],
(MAX_BITS_PER_WORD + 1) * 2);
ggc_add_tree_root (c_global_trees, CTI_MAX);
in init_decl_processing().
That one was not easy to track down :-(
Another lurking problem that bit me is that the version of
mark_addressable() in toy.c does the wrong thing if you
actually take the address of anything. The toy language
doesn't support pointers, so this is not an issue for toy
itself, but it makes toy.c harder to extend. I solved
that one by copying mark_addressable() from c-decl.c.
Another lurking problem is that pushdecl() is not called for
string_type_node, which I think means that if debugging is enabled
you don't get any debug info for that type.
(The "obvious fix" of calling spec1() for string_type_node doesn't
work, since it overwrites the TREE_TYPE() field. I discovered that
one the hard way.)
That's not an issue for toy itself, since toy doesn't support string
variables, but it makes it harder to extend toy to something that does.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.