Ping: [PATCH] PR88395 Fix Nullptr when compiling with -fconcepts

Jason Merrill jason@redhat.com
Wed Jun 12 21:16:00 GMT 2019


On 6/5/19 10:17 AM, Richard Sandiford wrote:
> Thanks for the patch and sorry that there was no response.
> I've added the C++ maintainers to cc:

Thanks.  In the future, mentioning C++ in the subject line will help me 
see it.

>> On 2019-04-08 7:20 p.m., Nicholas Krause wrote:
>>> This fixes the caller in tsubst_requires_expr to
>>> tsubst_constraint_variables to wrap their respective
>>> trees in PARM_CONSTR_PARMS. This is to get the correct
>>> parmeter constraints from the tree before calling
>>> tsubst_constraint_variables like other callers
>>> in constraint.cc and to fix the bug id, 88395 on
>>> the gcc bugzilla. OK for merge?
>>>
>>> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>>> ---
>>>   gcc/cp/constraint.cc | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
>>> index 9884eb0db50..a78d0a9a49b 100644
>>> --- a/gcc/cp/constraint.cc
>>> +++ b/gcc/cp/constraint.cc
>>> @@ -1882,7 +1882,7 @@ tsubst_requires_expr (tree t, tree args,
>>>     tree parms = TREE_OPERAND (t, 0);
>>>     if (parms)
>>>       {
>>> -      parms = tsubst_constraint_variables (parms, args, complain, in_decl);
>>> +      parms = tsubst_constraint_variables (PARM_CONSTR_PARMS (parms), args, complain, in_decl);

This change makes the testcase crash immediately because "parms" is a 
PARM_DECL, not a PARM_CONSTR.

As I just wrote on the PR, the problem in this testcase is that there's 
a recursive dependency of concepts: operator+= requires Concept, but 
checking Concept involves calling +=.  And so the compiler recurses 
infinitely and runs out of stack.  It would be good to catch this and 
give a more helpful error, but I don't think it's valid C++.

Jason



More information about the Gcc-patches mailing list