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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to