[llvm-bugs] [Bug 40187] New: clang::DominatorTree::buildDominatorTree crashes for codes with infinite while loops

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 30 09:36:20 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=40187

            Bug ID: 40187
           Summary: clang::DominatorTree::buildDominatorTree crashes for
                    codes with infinite while loops
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aadi.naik at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 21281
  --> https://bugs.llvm.org/attachment.cgi?id=21281&action=edit
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181230/c592d4e5/attachment-0001.html>


More information about the llvm-bugs mailing list