Skip to content

Commit 3f97eee

Browse files
committed
Increase souffle stack size when built with MSVC
Fix #2548
1 parent d6dfcb1 commit 3f97eee

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

.github/workflows/VS-CI-Tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ jobs:
6969
working-directory: ${{github.workspace}}/build
7070
shell: cmd
7171
run: |
72-
pushd "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build" & call vcvars64.bat & popd
72+
pushd "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build" & call vcvars64.bat & popd
7373
ctest --output-on-failure --build-config Release --progress -j4 -L interpreted
7474
7575
- name: Check others
7676
working-directory: ${{github.workspace}}/build
7777
shell: cmd
7878
run: |
79-
pushd "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build" & call vcvars64.bat & popd
79+
pushd "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build" & call vcvars64.bat & popd
8080
ctest --output-on-failure --build-config Release --progress -j2 -LE interpreted
8181

src/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,20 @@ if (MSVC)
422422
target_compile_definitions(libsouffle PUBLIC USE_CUSTOM_GETOPTLONG)
423423
target_compile_definitions(compiled PUBLIC USE_CUSTOM_GETOPTLONG)
424424
target_compile_definitions(souffleprof PUBLIC USE_CUSTOM_GETOPTLONG)
425+
426+
# 16MB stack size
427+
#
428+
# When compiled in with Visual Studio with the default stack size of 1MB,
429+
# the interpreter fails with a stack overflow in Engine::execute().
430+
# The cause is the number of lambda functions that are allocated as locals on the stack.
431+
# The stack frame of Engine::execute is close to 30KB.
432+
# The 1MB stack will overflow at depth ~34 of Engine::execute().
433+
#
434+
# Tests such as inline_nqueens and magic_nqueens would fail without a large-enough
435+
# stack size.
436+
#
437+
# See #2547.
438+
target_link_options(souffle PUBLIC "/STACK:16777216")
425439
endif (MSVC)
426440

427441
if (APPLE)

tests/evaluation/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,9 @@ positive_test(magic_infbinding)
100100
positive_test(magic_lrg_attr_id)
101101
positive_test(magic_movies)
102102
positive_test(magic_names1)
103-
positive_test(magic_neglabel)
104103
positive_test(magic_negignored)
105-
if (NOT (MSVC AND (CMAKE_BUILD_TYPE MATCHES Debug)))
106-
# When compiled in Debug with Visual Studio with the default stack size of 1MB,
107-
# the interpreter fails with a stack overflow in Engine::execute().
108-
# The cause is the number of lambda functions that are allocated as locals on the stack.
109-
# The stack frame of Engine::execute is close to 30KB.
110-
# The 1MB stack will overflow at depth ~34 of Engine::execute().
104+
positive_test(magic_neglabel)
111105
positive_test(magic_nqueens)
112-
endif ()
113106
positive_test(magic_perfect_numbers)
114107
positive_test(magic_posignored)
115108
positive_test(magic_poslabel)

0 commit comments

Comments
 (0)