[project @ 2003-03-17 14:47:47 by simonmar]
authorsimonmar <unknown>
Mon, 17 Mar 2003 14:47:48 +0000 (14:47 +0000)
committersimonmar <unknown>
Mon, 17 Mar 2003 14:47:48 +0000 (14:47 +0000)
Haskell quiz:  what should this program do?

  main = return undefined

answer: run to completion and exit successfully.  GHC erroneously
evaluates the returned value from main, which causes this example to
fail with an uncaught exception (the evaluation is even done outside
of the main exception handler!).

ghc/rts/Main.c
ghc/rts/Schedule.h
ghc/rts/Weak.c

index 0413168..ad6924f 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Main.c,v 1.35 2002/07/18 06:05:30 sof Exp $
+ * $Id: Main.c,v 1.36 2003/03/17 14:47:47 simonmar Exp $
  *
  * (c) The GHC Team 1998-2000
  *
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
                   fprintf(stderr, "==== [%x] Main Thread Started ...\n", mytid));
 
       /* ToDo: Dump event for the main thread */
-      status = rts_mainEvalIO((HaskellObj)mainIO_closure, NULL);
+      status = rts_mainLazyIO((HaskellObj)mainIO_closure, NULL);
     } else {
       /* Just to show we're alive */
       IF_PAR_DEBUG(verbose,
@@ -99,12 +99,12 @@ int main(int argc, char *argv[])
 #  elif defined(GRAN)
 
     /* ToDo: Dump event for the main thread */
-    status = rts_mainEvalIO(mainIO_closure, NULL);
+    status = rts_mainLazyIO(mainIO_closure, NULL);
 
 #  else /* !PAR && !GRAN */
 
     /* ToDo: want to start with a larger stack size */
-    status = rts_mainEvalIO((HaskellObj)mainIO_closure, NULL);
+    status = rts_mainLazyIO((HaskellObj)mainIO_closure, NULL);
 
 #  endif /* !PAR && !GRAN */
 
index cf49a78..b2a07e4 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Schedule.h,v 1.37 2003/01/25 15:54:50 wolfgang Exp $
+ * $Id: Schedule.h,v 1.38 2003/03/17 14:47:48 simonmar Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -151,7 +151,7 @@ extern nat         rts_n_waiting_tasks;
 
 StgInt forkProcess(StgTSO *tso);
 
-extern SchedulerStatus rts_mainEvalIO(HaskellObj p, /*out*/HaskellObj *ret);
+extern SchedulerStatus rts_mainLazyIO(HaskellObj p, /*out*/HaskellObj *ret);
 
 
 /* Called by shutdown_handler(). */
index f216f62..bc5cb2b 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Weak.c,v 1.27 2003/01/25 15:54:50 wolfgang Exp $
+ * $Id: Weak.c,v 1.28 2003/03/17 14:47:48 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -48,7 +48,7 @@ finalizeWeakPointersNow(void)
            rts_unlock();
            rts_lock();
 #else
-           rts_mainEvalIO(w->finalizer,NULL);
+           rts_mainLazyIO(w->finalizer,NULL);
 #endif
        }
     }