-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE / LLVM ERROR: Out of memory when compiling large std::array<shared_future<...>> with additional unexpected behaviours (C++23, Clang 19–21) #138653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We should probably do diff --git i/clang/lib/AST/ExprConstant.cpp w/clang/lib/AST/ExprConstant.cpp
index e5950f461e4b..2e6074d125f4 100644
--- i/clang/lib/AST/ExprConstant.cpp
+++ w/clang/lib/AST/ExprConstant.cpp
@@ -11788,6 +11788,12 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr(
LLVM_DEBUG(llvm::dbgs() << "The number of elements to initialize: "
<< NumEltsToInit << ".\n");
+ if (!Info.CheckArraySize(
+ ExprToVisit->getExprLoc(),
+ CAT->getNumAddressingBits(Info.Ctx), NumEltsToInit,
+ /*Diag=*/true))
+ return false;
+
Result = APValue(APValue::UninitArray(), NumEltsToInit, NumElts);
// If the array was previously zero-initialized, preserve the to check for the array size. |
@llvm/issue-subscribers-clang-frontend Author: None (mariete1223)
## Summary
LLVM ERROR: out of memory strange error, it occurs with std=c++23 and versions 19, 20 and current, it has been found that in current version if you remove AssertionNo assertion given Stack dump
Program#include <thread>
#include <future>
#include <memory>
using namespace std;
constexpr size_t kMemoryChunk = 1024 * 8;
constexpr size_t kNumberOfIterations = 2000000;
constexpr size_t kThreadsNumber = 2 * kMemoryChunk;
int main() {
array<shared_future<short*>, kThreadsNumber * kNumberOfIterations> futures{};
} Gcc BoltHere it can be seen stranger behaviour when include is removed. https://gcc.godbolt.org/z/af8eKT3ax Here in current version with include https://gcc.godbolt.org/z/zv6b6vWs1 Additional questionI am also wondering if LLVM ERROR: out of memory programs are worth submiting an issue, thanks in advance |
Reduced a bit: https://gcc.godbolt.org/z/e3McKqPez #include <array>
constexpr unsigned kMemoryChunk = 1024 * 8;
constexpr unsigned kNumberOfIterations = 2000000;
constexpr unsigned kThreadsNumber = 2 * kMemoryChunk;
template <typename T>
class A{};
int main() {
std::array<A<short*>, kThreadsNumber * kNumberOfIterations> futures{};
} |
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: None (mariete1223)
## Summary
LLVM ERROR: out of memory strange error, it occurs with std=c++23 and versions 19, 20 and current, it has been found that in current version if you remove AssertionNo assertion given Stack dump
Program#include <thread>
#include <future>
#include <memory>
using namespace std;
constexpr size_t kMemoryChunk = 1024 * 8;
constexpr size_t kNumberOfIterations = 2000000;
constexpr size_t kThreadsNumber = 2 * kMemoryChunk;
int main() {
array<shared_future<short*>, kThreadsNumber * kNumberOfIterations> futures{};
} Gcc BoltHere it can be seen stranger behaviour when include is removed. https://gcc.godbolt.org/z/af8eKT3ax Here in current version with include https://gcc.godbolt.org/z/zv6b6vWs1 Additional questionI am also wondering if LLVM ERROR: out of memory programs are worth submiting an issue, thanks in advance |
Removing the beginner label since there's a PR already. |
Summary
LLVM ERROR: out of memory strange error, it occurs with std=c++23 and versions 19, 20 and current, it has been found that in current version if you remove
#include <thread>
the compiler does not crashes but in version 20 and 19 it does.Assertion
No assertion given
Stack dump
Program
Gcc Bolt
Here it can be seen stranger behaviour when include is removed.
https://gcc.godbolt.org/z/af8eKT3ax
Here in current version with include
https://gcc.godbolt.org/z/zv6b6vWs1
Additional question
I am also wondering if LLVM ERROR: out of memory programs are worth submiting an issue, thanks in advance
The text was updated successfully, but these errors were encountered: