Segfault Question

Nathan Sidwell nathan@acm.org
Mon Dec 17 14:55:00 GMT 2018


On 12/14/18 10:55 AM, nick wrote:
> Greetings All,
> I was attempting to fix this bug:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88395#add_comment
> 
> and managed to track it down to expand_concept in constraint.cc.
> 
> Seems that we are hitting this case in tsubst_expr for the NULL_TREE:
> if (t == NULL_TREE || t == error_mark_node)
> 	return t
> and we only check result for error_mark_node. Is error_mark_node
> equal to a NULL_TREE or is it something else?

error_mark_node is a non-null pointer to a tree_node with ERROR_MARK as 
its tree code.  (if you build with CXXFLAGS=-g3 you'll get macros 
available so gdb's 'p error_mark_node' will work)

> If not than it seems
> that we should change our check to:
> if (result == error_mark_node || result == NULL_TREE)
> 
> and it seems that this is also not checked it the other callers so it
> should be fixed.

Swapping the || arguments is not the fix -- it'll make no difference (in 
a well-formed program).

> Let me known if I am missing something,

If the optimizers have removed the 't == NULL_TREE' check, that's 
because they've determined that 't' cannot be null at that point. 
Something earlier has convinced them otherwise -- usually a dereference 
will do that.

nathan
-- 
Nathan Sidwell



More information about the Gcc mailing list