[PATCH] Fix "#pragma clang __debug overflow_stack" for MSVC builds

Greg Bedwell greg_bedwell at sn.scee.net
Thu Aug 28 13:34:27 PDT 2014


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.

http://reviews.llvm.org/D5109

Files:
  lib/Lex/Pragma.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5109.13056.patch
Type: text/x-patch
Size: 354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140828/727eb2df/attachment.bin>


More information about the cfe-commits mailing list