r197849 - Use this one little trick to prevent optimizers from removing an

Richard Trieu rtrieu at google.com
Fri Dec 20 17:04:02 PST 2013


Author: rtrieu
Date: Fri Dec 20 19:04:02 2013
New Revision: 197849

URL: http://llvm.org/viewvc/llvm-project?rev=197849&view=rev
Log:
Use this one little trick to prevent optimizers from removing an
intentional stack overflow.

Modified:
    cfe/trunk/lib/Lex/Pragma.cpp

Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=197849&r1=197848&r2=197849&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Fri Dec 20 19:04:02 2013
@@ -926,8 +926,9 @@ struct PragmaDebugHandler : public Pragm
 #ifdef _MSC_VER
     #pragma warning(disable : 4717)
 #endif
-  void DebugOverflowStack() {
-    DebugOverflowStack();
+  static void DebugOverflowStack() {
+    void (*volatile Self)() = DebugOverflowStack;
+    Self();
   }
 #ifdef _MSC_VER
     #pragma warning(default : 4717)





More information about the cfe-commits mailing list