Skip to content

Commit db3fc1d

Browse files
dschoGit for Windows Build Agent
authored andcommitted
max_tree_depth: lower it for clang builds in general on Windows
In 436a422 (max_tree_depth: lower it for clangarm64 on Windows, 2025-04-23), I provided a work-around for a nasty issue with clangarm builds, where the stack is exhausted before the maximal tree depth is reached, and the resulting error cannot easily be handled by Git (because it would require Windows-specific handling). Turns out that this is not at all limited to ARM64. In my tests with CLANG64 in MSYS2 on the GitHub Actions runners, the test t6700.4 failed in the exact same way. What's worse: The limit needs to be quite a bit lower for x86_64 than for aarch64. In aforementioned tests, the breaking point was 1232: With 1231 it still worked as expected, with 1232 it would fail with the `STATUS_STACK_OVERFLOW` incorrectly mapped to exit code 127. For comparison, in my tests on GitHub Actions' Windows/ARM64 runners, the breaking point was 1439 instead. Therefore the condition needs to be adapted once more, to accommodate (with some safety margin) both aarch64 and x86_64 in clang-based builds on Windows, to let that test pass. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 28041d2 commit db3fc1d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

environment.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,22 @@ int max_allowed_tree_depth =
9191
* the stack overflow can occur.
9292
*/
9393
512;
94-
#elif defined(GIT_WINDOWS_NATIVE) && defined(__clang__) && defined(__aarch64__)
94+
#elif defined(GIT_WINDOWS_NATIVE) && defined(__clang__)
9595
/*
96-
* Similar to Visual C, it seems that on Windows/ARM64 the clang-based
97-
* builds have a smaller stack space available. When running out of
98-
* that stack space, a `STATUS_STACK_OVERFLOW` is produced. When the
96+
* Similar to Visual C, it seems that clang-based builds on Windows
97+
* have a smaller stack space available. When running out of that
98+
* stack space, a `STATUS_STACK_OVERFLOW` is produced. When the
9999
* Git command was run from an MSYS2 Bash, this unfortunately results
100100
* in an exit code 127. Let's prevent that by lowering the maximal
101-
* tree depth; This value seems to be low enough.
101+
* tree depth; Unfortunately, it seems that the exact limit differs
102+
* for aarch64 vs x86_64, and the difference is too large to simply
103+
* use a single limit.
102104
*/
105+
#if defined(__aarch64__)
103106
1280;
107+
#else
108+
1152;
109+
#endif
104110
#else
105111
2048;
106112
#endif

0 commit comments

Comments
 (0)