[llvm] r192904 - CMake: set stack size to 2MB for MSVC builds

Hans Wennborg hans at chromium.org
Thu Oct 17 11:45:39 PDT 2013


On Thu, Oct 17, 2013 at 11:14 AM, Hans Wennborg <hans at chromium.org> wrote:
> On Thu, October 17, 2013 19:56, Reid Kleckner wrote:
>> I thought we already committed a patch like this, but apparently not.
>
> You're right! I just found this in CMakeLists:
>
> if(MSVC AND NOT (${CMAKE_VERSION} VERSION_LESS 2.8.11))
>   # set stack reserved size to ~10MB
>   # CMake previously automatically set this value for MSVC builds, but the
>   # behavior was changed in CMake 2.8.11 (Issue 12437) to use the MSVC default
>   # value (1 MB) which is not enough for us in tasks such as parsing recursive
>   # C++ templates in Clang.
>   set(CMAKE_CXX_STACK_SIZE "10000000")
> endif()
>
> I wonder why that didn't work..

I don't think CMAKE_CXX_STACK_SIZE really worked. Grepping for it in
cmake's source suggests it might work in the VS2010 project generator,
but it's not documented and didn't work for me using ninja.

Setting the /STACK flag directly seems to be the way to go.

I've combined the two approaches in r192912.

>> On Thu, Oct 17, 2013 at 10:49 AM, Hans Wennborg <hans at hanshq.net> wrote:
>>
>>> Author: hans
>>> Date: Thu Oct 17 12:49:57 2013
>>> New Revision: 192904
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=192904&view=rev
>>> Log:
>>> CMake: set stack size to 2MB for MSVC builds
>>>
>>> Compiling under Visual C++ 2012 with the default stack size of 1MB, the
>>> stack
>>> overflows at a depth of 216 template instantiations, well before the 256
>>> default limit. This patch modifies the default MSVC stack size to 2MB.
>>>
>>> Patch by Yaron Keren!



More information about the llvm-commits mailing list