<div dir="ltr">Artem,<div><br></div><div>First of all, thank you for your reply.<br><br>Indeed, I am auto-generating AST made of regular nodes. More specifically, my SpecStmt node has four sub-nodes. A DeclStmt that I use to hang the variables a need, a Expr to compare __spec_mode and decide which path to take (SlowPath or FastPath) and two CompoundStmts. So SpecStmt looks like an IfStmt with both then and else statements.<br><br>Bellow is the part of the AST which triggers the sigsegv (Please find the AST for the whole FunctionDecl attached):</div><div><br></div><div><div>|   |       |-<b>SpecStmt</b> 0x15c1ca8 <./spec.h:127:32></div><div>|   |       | |-DeclStmt 0x15c09e8 <col:32></div><div>|   |       | | |-VarDecl 0x15c0368 <col:32> col:32 <b>__setjmp_buf</b> 'jmp_buf':'struct __jmp_buf_tag [1]' auto</div><div>|   |       | | |-VarDecl 0x15c03c8 <col:32> col:32 <b>__setjmp_ret</b> 'int' auto cinit</div><div>|   |       | | | `-CallExpr 0x15c0630 <col:32> 'int'</div><div>|   |       | | |   |-ImplicitCastExpr 0x15c0618 <col:32> 'int (*)(jmp_buf *)' <FunctionToPointerDecay></div><div>|   |       | | |   | `-DeclRefExpr 0x15c05e0 <col:32> 'int (jmp_buf *)' Function 0x15c04d8 '<b>setjmp</b>' 'int (jmp_buf *)'</div><div>|   |       | | |   `-ImplicitCastExpr 0x15c0450 <col:32> 'jmp_buf *' <ArrayToPointerDecay></div><div>|   |       | | |     `-DeclRefExpr 0x15c0428 <col:32> 'jmp_buf':'struct __jmp_buf_tag [1]' Var 0x15c0368 '<b>__setjmp_buf</b>' 'jmp_buf':'struct __jmp_buf_tag [1]'</div><div>|   |       | | `-VarDecl 0x15c0660 <col:32> col:32 <b>__spec_mode</b> 'unsigned int' auto cinit</div><div>|   |       | |   `-CallExpr 0x15c0990 <col:32> 'unsigned int'</div><div>|   |       | |     |-ImplicitCastExpr 0x15c0978 <col:32> 'unsigned int (*)(jmp_buf *, int)' <FunctionToPointerDecay></div><div>|   |       | |     | `-DeclRefExpr 0x15c0940 <col:32> 'unsigned int (jmp_buf *, int)' Function 0x15c07d0 '<b>__spec_begin</b>' 'unsigned int (jmp_buf *, int)'</div><div>|   |       | |     |-ImplicitCastExpr 0x15c0730 <col:32> 'jmp_buf *' <LValueToRValue></div><div>|   |       | |     | `-UnaryOperator 0x15c06e8 <col:32> 'jmp_buf *' prefix '&'</div><div>|   |       | |     |   `-DeclRefExpr 0x15c06c0 <col:32> 'jmp_buf':'struct __jmp_buf_tag [1]' Var 0x15c0368 '<b>__setjmp_buf'</b> 'jmp_buf':'struct __jmp_buf_tag [1]'</div><div>|   |       | |     `-ImplicitCastExpr 0x15c0748 <col:32> 'int' <LValueToRValue> </div><div>|   |       | |       `-DeclRefExpr 0x15c0708 <col:32> 'int' Var 0x15c03c8 '<b>__setjmp_ret</b>' 'int'</div><div>|   |       | |-BinaryOperator 0x15c0a60 <col:32> 'bool' lvalue '=='</div><div>|   |       | | |-ImplicitCastExpr 0x15c0a28 <col:32> 'unsigned int' <LValueToRValue></div><div>|   |       | | | `-DeclRefExpr 0x15c0a00 <col:32> 'unsigned int' lvalue Var 0x15c0660 '<b>__spec_mode'</b> 'unsigned int'</div><div>|   |       | | `-IntegerLiteral 0x15c0a40 <col:32> 'int' 1</div><div>|   |       | |-CompoundStmt 0x15c1c38 <col:32></div></div><div><br></div><div dir="ltr"><br></div><div>Thanks in advance for any help!<br><br></div><div>Respectfully,</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 24, 2018 at 4:36 PM Artem Dergachev <<a href="mailto:noqnoqneo@gmail.com">noqnoqneo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Is the DeclRefExpr for __spec_mode pointing to a valid VarDecl?
    Would this VarDecl be encountered previously during analysis in
    order to populate TransferFunctions::vals()? Dunno if that makes
    sense, i didn't really look at this analysis.<br>
    <br>
    I guess i want to look at your full -ast-dump. It seems that you are
    not only adding a new Stmt kind, but also you're getting into
    business of auto-generating AST made of some regular nodes, probably
    as its children. This is often hard because it's very easy to break
    invariants that the normal AST obeys and there's no way to verify
    those invariants other than seeing how everything crashes and
    debugging.<br>
    <br>
    <div class="m_-6700653932672170602moz-cite-prefix">On 9/24/18 4:43 AM, João Paulo
      Labegalini de Carvalho via cfe-dev wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">You are right, I should have been more specific.
          In my case crashing means segmentation fault inside runOnBlock
          function (lib/Analysis/UninitializedValues.cpp).<br>
          <br>
          Please find the stack trace attached.</div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr">On Mon, Sep 24, 2018 at 4:09 AM Csaba Raduly
            <<a href="mailto:rcsaba@gmail.com" target="_blank">rcsaba@gmail.com</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi João
            Paulo,<br>
            <br>
            <br>
            On Sun, Sep 23, 2018 at 11:39 PM, João Paulo Labegalini de
            Carvalho<br>
            via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>
            wrote:<br>
            > Hi,<br>
            ><br>
            > I have implemented a new Stmt in clang which given<br>
            ><br>
            > __speculate {<br>
            >  // user code<br>
            > }<br>
            ><br>
            > generates LLVM IR equivalent to as if the following
            code was given:<br>
            ><br>
            ...<br>
            ><br>
            > However, if UninitializedVariablesAnalysis is enabled,
            clang crashes at<br>
            > runOnBlock function
            (lib/Analysis/UninitializedValues.cpp). If I disable it<br>
            > via -Wno-uninitialized, the code generated runs
            flawlessly and works as<br>
            > expected.<br>
            <br>
            "crash" is a meaningless term. Does it generate an access
            violation,<br>
            an assertion failure, or something else?<br>
            What was the error message? Is there a stack trace?<br>
            <br>
            <br>
            Csaba<br>
            <br>
            -- <br>
            You can get very substantial performance improvements<br>
            by not doing the right thing. - Scott Meyers, An Effective
            C++11/14 Sampler<br>
            So if you're looking for a completely portable, 100%
            standards-conformat way<br>
            to get the wrong information: this is what you want. - Scott
            Meyers (C++TDaWYK)<br>
          </blockquote>
        </div>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div dir="ltr" class="m_-6700653932672170602gmail_signature" data-smartmail="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div>João Paulo L. de Carvalho<br>
                  Computer Science |  IC-UNICAMP | Campinas , SP -
                  Brazil</div>
                <div><a href="mailto:jaopaulolc@gmail.com" target="_blank">jaopaulolc@gmail.com</a></div>
                <div><a href="mailto:joao.carvalho@ic.unicamp.br" target="_blank">joao.carvalho@ic.unicamp.br</a><br>
                  <a href="mailto:j160924@dac.unicamp.br" target="_blank">j160924@dac.unicamp.br</a></div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="m_-6700653932672170602mimeAttachmentHeader"></fieldset>
      <pre class="m_-6700653932672170602moz-quote-pre">_______________________________________________
cfe-dev mailing list
<a class="m_-6700653932672170602moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a class="m_-6700653932672170602moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>João Paulo L. de Carvalho<br>Computer Science |  IC-UNICAMP | Campinas , SP - Brazil</div><div><a href="mailto:jaopaulolc@gmail.com" target="_blank">jaopaulolc@gmail.com</a></div><div><a href="mailto:joao.carvalho@ic.unicamp.br" target="_blank">joao.carvalho@ic.unicamp.br</a><br><a href="mailto:j160924@dac.unicamp.br" target="_blank">j160924@dac.unicamp.br</a></div></div></div></div></div>