Pragma: Fix DebugOverflowStack() resulting in endless loop.

Drive-by fix (noticed while working on https://reviews.llvm.org/D32205):
DebugOverflowStack() is supposed to provoke a stack overflow, however
LLVM was smart enough to use the red-zone and fold the load into a tail
jump on x86_64 optimizing this to an endless loop instead of a stack
overflow.

llvm-svn: 301218
This commit is contained in:
Matthias Braun 2017-04-24 18:41:00 +00:00
parent 0d447d514a
commit 285f88d4a3
1 changed files with 3 additions and 3 deletions

View File

@ -989,9 +989,9 @@ struct PragmaDebugHandler : public PragmaHandler {
#ifdef _MSC_VER
#pragma warning(disable : 4717)
#endif
static void DebugOverflowStack() {
void (*volatile Self)() = DebugOverflowStack;
Self();
static void DebugOverflowStack(void (*P)() = nullptr) {
void (*volatile Self)(void(*P)()) = DebugOverflowStack;
Self(reinterpret_cast<void(*)()>(Self));
}
#ifdef _MSC_VER
#pragma warning(default : 4717)