Fixed check_function_subtree, added const analysis

Also renamed stack_t to stacklist_t due to some conflicts with
something external.