This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I was learning about `delay' and `force' today, and read that implementations are free to allow force of expressions that are not promises. I tried it in guile, and got a segv. I've just begun to learn to use `gdb'. :-) Here's what it shows me: guile> (force 9) Breakpoint 2, scm_force (x=38) at eval.c:3346 (gdb) step Program received signal SIGSEGV, Segmentation fault. 0x40029461 in scm_force (x=38) at eval.c:3346 (gdb) Here's a patch and proof that it is correct. guile> (force 9) Backtrace: 0* [force 9] ERROR: In procedure force in expression (force 9): ERROR: Wrong type argument in position 1: 9 ABORT: (wrong-type-arg) 1998-09-07 Karl M. Hegbloom <karlheg@bittersweet.inetarena.com> * eval.c (scm_force): Assert that x is SCM_NIMP to fix segv when (force 9) is tried. Index: eval.c =================================================================== RCS file: /usr/local/cvsroot/debian/guile-core/libguile/eval.c,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 eval.c --- eval.c 1998/08/26 17:14:05 1.1.1.1 +++ eval.c 1998/09/07 11:59:38 @@ -3343,7 +3343,7 @@ scm_force (x) SCM x; { - SCM_ASSERT ((SCM_TYP16 (x) == scm_tc16_promise), x, SCM_ARG1, s_force); + SCM_ASSERT ((SCM_NIMP(x) && (SCM_TYP16 (x) == scm_tc16_promise)), x, SCM_ARG1, s_force); if (!((1L << 16) & SCM_CAR (x))) { SCM ans = scm_apply (SCM_CDR (x), SCM_EOL, SCM_EOL);