Hi Clang Developers,
I noticed that using "#pragma clang __debug overflow_stack" on clang.exe built by Visual Studio 2012, to force a stack overflow causes it to seemingly hang indefinitely (I left it running overnight and it hadn't finished by morning). This patch just ensures that there is actually some new stack usage on every call to DebugOverflowStack. With this patch the overflow_stack pragma causes clang.exe to crash immediately with a big callstack full of DebugOverflowStack as I'd expect.
I've got a test for it, but when testing on Linux ran into the issue described at https://savannah.gnu.org/bugs/?22010 where GNU Make 3.81 has a bug where spawned processes get an unlimited stack size. Obviously this doesn't play well with a test designed to overflow the stack and brought the whole system to a halt. It works correctly when running through lit directly.
Here is my test for reference. Any suggestions to robustify it against the above behaviour are appreciated! I thought about adding a "REQUIRES: system-windows" but I'm not sure if some people may be using Make on Windows or whether it suffers from the same issue as on Linux.
RUN: not %clang %s -fsyntax-only 2>&1 | FileCheck %s
REQUIRES: crash-recovery
#pragma clang __debug overflow_stack
// CHECK: PLEASE submit a bug report
Otherwise, is it okay to commit the attached patch without the test?
Many Thanks,
Greg Bedwell
SN Systems - Sony Computer Entertainment Inc.
Add a comment explaining what this is.