<div dir="ltr">I did an x64 build of clang on Windows yesterday and this morning confirmed that this does in fact crash with stack overflow, FWIW.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 24, 2013 at 7:32 AM,  <span dir="ltr"><<a href="mailto:Greg_Bedwell@sn.scee.net" target="_blank">Greg_Bedwell@sn.scee.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
This is my first attempt at submitting a patch, so please go easy on me<br>
:-).<br>
<br>
I recently upgraded our version of CMake to 2.8.11.2 and was surprised to<br>
find that one of our test suites showed a new crash in our MSVC-built<br>
clang.  Debugging showed that it was caused by clang overflowing the<br>
Windows stack.  I eventually tracked it down to a change to resolve the<br>
following issue in CMake:<br>
<a href="http://www.gccxml.org/Bug/view.php?id=12437" target="_blank">http://www.gccxml.org/Bug/view.php?id=12437</a> [Default link line includes<br>
massive stack size of 10M with the /STACK:10000000 option ]<br>
<br>
The effect of this change in CMake is to reduce the Windows stack size for<br>
CMake built executables from ~10MB to the default value of 1MB.  I've only<br>
seen this cause an issue in clang when parsing recursive templates so I've<br>
included a clang test, but in theory could affect any tool built in the<br>
LLVM tree so my fix is in the top-level LLVM CMake file.  My fix<br>
explicitly sets the previous 10000000 bytes value in order to maintain<br>
consistent behaviour between builds using different versions of CMake.<br>
<br>
Unfortunately, due to a bug in previous versions of CMake (<br>
<a href="http://www.cmake.org/Bug/view.php?id=13968" target="_blank">http://www.cmake.org/Bug/view.php?id=13968</a> ), specifying<br>
CMAKE_CXX_STACK_SIZE results in a link error of missing "10000000.obj" so<br>
I've had to guard my change against the version of CMake being greater<br>
than or equal to 2.8.11.  My idea is that at some point in the future we<br>
may set the minimum version of CMake to at least 2.8.11 in which case we<br>
could consider finding a more appropriate value for CMAKE_CXX_STACK_SIZE<br>
but for now I think keeping consistency is important (i.e. if the process<br>
stack size changes, it should be traceable to a specific revision where a<br>
value was changed, rather than some change external to the LLVM/Clang<br>
trees such as differing versions of CMake being used).<br>
<br>
Without this fix, the attached test will crash due to a stack overflow,<br>
when generating the project with CMake 2.8.11 (on VS2010 x64 at least) and<br>
will pass when the project is generated with earlier versions of CMake.  I<br>
have a slight concern that the test may cause issues for any hosts we<br>
support with smaller default stacks.  If this is a real problem then a<br>
test may not be appropriate in this case.<br>
<br>
<br>
<br>
I appreciate any feedback you may have.  Please commit for me if you are<br>
happy with the change.<br>
<br>
Thanks,<br>
<br>
--<br>
Greg Bedwell<br>
SN Systems - Sony Computer Entertainment Group<br>
<a href="http://www.snsys.com" target="_blank">http://www.snsys.com</a><br>
<br>
<br>
<br>
<br>
**********************************************************************<br>
This email and any files transmitted with it are confidential and intended<br>
solely for the use of the individual or entity to whom they are addressed.<br>
If you have received this email in error please notify <a href="mailto:postmaster@scee.net">postmaster@scee.net</a><br>
This footnote also confirms that this email message has been checked for<br>
all known viruses.<br>
Sony Computer Entertainment Europe Limited<br>
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United<br>
Kingdom<br>
Registered in England: 3277793<br>
**********************************************************************<br>
<br>
P Please consider the environment before printing this e-mail<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>