This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bugs in toy compiler


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]