The Interpreter was failing the AtExit UnitTest. This fixes it.
authorBrian Gaeke <gaeke@uiuc.edu>
Fri, 13 Feb 2004 05:48:00 +0000 (05:48 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Fri, 13 Feb 2004 05:48:00 +0000 (05:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11367 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/Interpreter/Execution.cpp

index 57ae6215456a8fbbdeff7655c399359b5b0bcf79..5379c04fbf677f04d59612462dcee47a36c13394 100644 (file)
@@ -523,6 +523,10 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) {
 //===----------------------------------------------------------------------===//
 
 void Interpreter::exitCalled(GenericValue GV) {
+  // runAtExitHandlers() assumes there are no stack frames, but
+  // if exit() was called, then it had a stack frame. Blow away
+  // the stack before interpreting atexit handlers.
+  ECStack.clear ();
   runAtExitHandlers ();
   exit (GV.IntVal);
 }