[clang] [clang] Fix segmentation fault caused by stack overflow on deeply nested expressions (PR #111701)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 11 09:25:21 PDT 2024
================
@@ -0,0 +1,1013 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -Wstack-exhausted -verify
+
+class AClass {
+public:
+ AClass() {}
+ AClass &foo() { return *this; }
+};
+
+void test_bar() {
+ AClass a;
+ // expected-warning@* {{stack nearly exhausted; compilation time may suffer, and crashes due to stack overflow are likely}}
+ a.foo().foo().foo().foo().foo().foo().foo().foo().foo().foo().foo().foo()
----------------
ilya-biryukov wrote:
I can understand the desire to keep important information visible, but I find the fact that humans have a limited ability to comprehend large chunks of information important.
For a test like this, the important information for me is:
- how deep is the expression,
- what kind of an expression it is.
The vast size of the file makes it harder, not simpler, to get that information and it also requires extra actions (going to the end of the file) to make sure there isn't something else that the reader needs to know.
Preprocessor is generally very reliable and well-understood, so I'd still lean towards the smaller version here.
https://github.com/llvm/llvm-project/pull/111701
More information about the cfe-commits
mailing list