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]
Other format: [Raw text]

Invalid tree node causes segfault in diagnostic


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.

For the patch attached:

2013-10-11  Paulo Matos  <pmatos@broadcom.com>

	* tree.c (tree_check_failed): Check that TREE_CODE is valid before 
	passing it to tree_code_name.


Paulo Matos


Attachment: tree_check_failed.patch
Description: tree_check_failed.patch


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