Question about a c-index-test testcase


I am working on the implementation of the coldcc calling convention. I’ve written a functional testing patch which will aggressively mark functions with the coldcc attribute to test the handling of coldcc. My changes cause a function to have a larger stack frame and when I mark two recursive functions in c-index-test with coldcc, it will lead to increasing the stack size by a large amount. Due to this, I expose a failure in the following test case:

This test tries to exhaust the stack through recursion and tests that a segmentation fault does not occur. When debugging this test case, I noticed there is a default 8 MB stack size assigned to the thread.
In tools/clang/tools/libclang/CIndex.cpp we have:
/// Default to using an 8 MB stack size on “safety” threads.
static unsigned SafetyStackThreadSize = 8 << 20;

So even without my changes, if I increase the test case to add more of the () operations, I can create a segmentation fault when going past the 8 MB mark. I’m wondering how this test was created and whether it is too fragile due to the 8 MB limit.

Zaara Syeda