Patchwork [RFC,/] PR 54403

login
register
mail settings
Submitter Paolo Carlini
Date Sept. 11, 2012, 2:11 a.m.
Message ID <504E9DD9.9090704@oracle.com>
Download mbox | patch
Permalink /patch/182993/
State New
Headers show

Comments

Paolo Carlini - Sept. 11, 2012, 2:11 a.m.
Hi,

I just had a quick look to this PR, for:

template <class T>
class Foo
{
   bool m_barbar;

   void Bar()
   {
     auto bar = [this]() { if (!m_barbar) { } };
   }
};

we ICE as a Seg fault in lvalue_kind, at line # 147, because for ref we 
have an INDIRECT_REF with null TREE_TYPE:

     case INDIRECT_REF:
     case ARROW_EXPR:
     case ARRAY_REF:
     case PARM_DECL:
     case RESULT_DECL:
       if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)    // 147
     return clk_ordinary;
       break;

I noticed that elsewhere in the function we handle a null TREE_TYPE and 
I quickly tried the trivial attached patchlet which works for the 
testcase, in that lvalue_kind ends up simply returning clk_none. Does it 
make sense to you?

Thanks!
Paolo.

/////////////////

Patch

Index: tree.c
===================================================================
--- tree.c	(revision 191169)
+++ tree.c	(working copy)
@@ -144,7 +144,7 @@  lvalue_kind (const_tree ref)
     case ARRAY_REF:
     case PARM_DECL:
     case RESULT_DECL:
-      if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
+      if (TREE_TYPE (ref) && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
 	return clk_ordinary;
       break;