On Fri, Oct 11, 2013 at 12:57 PM, Paulo Matos <pma...@broadcom.com> wrote: > Hello, > > I have a testcase that, during parsing, generates an invalid tree. This > invalid tree triggers tree_check_failed, which was expecting a string_cst. > tree_check_failed calls internal_error with tree_code_name[TREE_CODE (node)] > without checking that TREE_CODE (node) is valid. > > I attach a patch as a suggestion of a fix. I would like some comments. > > This patch eliminates the segfault and generates the error: > ../../../../../source/adsl-mech/components/common/PsdInfo.c:717:1: internal > compiler error: tree check: expected string_cst, have (invalid code name) in > get_named_section, at varasm.c:415 > > This is obviously another thing I still have to understand why it's happening. > The testcase is still too big (1Mb) and I haven't reproduced it with any > upstream port so I am not reporting a bug yet.
Hmm. We have several places accessing tree_code_name without checking. May I suggest to abstract accesses to it with a function call which can do the proper checking and return "<invalid tree code>" instead? Thanks, Richard. > For the patch attached: > > 2013-10-11 Paulo Matos <pma...@broadcom.com> > > * tree.c (tree_check_failed): Check that TREE_CODE is valid before > passing it to tree_code_name. > > > Paulo Matos > >