Issue 148397
Summary Optimizer optimizes out potential infinite loop
Labels new issue
Assignees
Reporter Pranavkumar-T-S
    ### All information necessary to reproduce the problem.

It is reproducible in 
- version: clang 18 and above 
- architecture: x86_64, armv8-a, arv7-a
- optimization flag : O1 and above
- standard : c++11 and above

### The reduced test-case that triggers the bug.

``` cpp
#include <iostream>
#include <unordered_set>
int main() {
    std::unordered_set<int> isPresent;
    isPresent.insert(0);
    // std::cout << "before loop, size of isPresent: " << isPresent.size() << std::endl;
    while (!isPresent.empty()) {
        // std::cout << "infinite loop " << std::endl;
    };
    // std::cout << "after loop " << std::endl;

    return 0;
}
```

### The location where you obtained LLVM (if not from our Git repository).

- it is from [compiler explorer](https://godbolt.org/).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to