<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang::DominatorTree::buildDominatorTree crashes for codes with infinite while loops"
   href="https://bugs.llvm.org/show_bug.cgi?id=40187">40187</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang::DominatorTree::buildDominatorTree crashes for codes with infinite while loops
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aadi.naik@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21281" name="attach_21281" title="A tar of the folder containing the RAV code as well as some test cases">attachment 21281</a> <a href="attachment.cgi?id=21281&action=edit" title="A tar of the folder containing the RAV code as well as some test cases">[details]</a></span>
A tar of the folder containing the RAV code as well as some test cases

The buildDominatorTree function gives a segmentation fault when trying to build
a dominator tree within a RecursiveASTVisitor Visit function for a code
containing an infinite loop (specifically where the condition is 1) like this
code-
int main() {
    int x, y, z;
    x = 10;
    while(1) {
        x++;
        if(x == 100) {
            break;
        }
    }
    return 0;
}

Assigning the value 1 to a variable and using the variable as a condition does
not cause an issue-

int main() {
    int x, y, z;
    x = 10;
    y = 1;
    while(y) {
        x++;
        if(x == 100) {
            break;
        }
    }
    return 0;
}

The code for reproducing the error as well as the test cases are in the tar
file

Found when using Clang 7 and LLVM 7 installed from the Debian packages</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>