
5.hs: module Main where main = mapM_ putStrLn [ "echo " ++ show x ++ " | a.out " | x <- [1..]] [khaliff@90-mia-3 khaliff]$ hmake 5 nhc98 -c -o 5.o 5.hs nhc98 -o 5 5.o [khaliff@90-mia-3 khaliff]$ 5 > /dev/null hPutStr: internal error, not a cons-list! hPutStr: got CONSTRW src=0x401cc80c size=1 hPutStr: char='' [khaliff@90-mia-3 khaliff]$ nhc98 --version /usr/local/bin/nhc98: v1.04 (2001-05-21) [ config: ix86-Linux/ghc by khaliff@90-mia-3.acn.waw.pl on 25 May 2001 ] Wojciech Moczydlowski, Jr

main = mapM_ putStrLn [ "echo " ++ show x ++ " | a.out " | x <- [1..]]
hPutStr: internal error, not a cons-list! hPutStr: got CONSTRW src=0x401cc80c size=1 hPutStr: char=''
Yes, this bug appears to be present in 1.06 as well. If you change the runtime heapsize, it sometimes manifests as a segmentation fault, other times as a (correct) out-of-heap error. This suggests a garbage collector problem. I also have a couple of other example programs displaying odd behaviour of this nature. As a workaround, you can set the heapsize to one which appears to work. Unfortunately, you'll have to do that by trial and error - for some programs a smaller heap is best, for others, a larger heap. Meanwhile, I'm searching for a proper fix. Regards, Malcolm

main = mapM_ putStrLn [ "echo " ++ show x ++ " | a.out " | x <- [1..]]
hPutStr: internal error, not a cons-list! hPutStr: got CONSTRW src=0x401cc80c size=1 hPutStr: char=''
I have located and fixed this bug. Patch appended, and also available from the nhc98 website. Regards, Malcolm Index: src/runtime/Builtin/cHPutStr.c =================================================================== RCS file: /usr/src/master/nhc/src/runtime/Builtin/cHPutStr.c,v retrieving revision 1.5 diff -u -r1.5 cHPutStr.c --- src/runtime/Builtin/cHPutStr.c 2001/02/07 18:15:06 1.5 +++ src/runtime/Builtin/cHPutStr.c 2001/06/11 16:38:31 @@ -93,9 +93,11 @@ break; case 1: /* (:) */ chr = GET_POINTER_ARG1(src,1); + C_PUSH(src); C_PUSH(chr); C_EVALTOS(chr); chr = C_POP(); + src = C_POP(); IND_REMOVE(chr); c = GET_CHAR_VALUE(chr); err = fputc(c,f->fp); @@ -135,9 +137,11 @@ break; case 1: /* (:) */ chr = GET_POINTER_ARG1(src,1); + C_PUSH(src); C_PUSH(chr); C_EVALTOS(chr); chr = C_POP(); + src = C_POP(); IND_REMOVE(chr); *dstptr = GET_CHAR_VALUE(chr); switch (*dstptr++) { @@ -203,9 +207,11 @@ break; case 1: /* (:) */ chr = GET_POINTER_ARG1(src,1); + C_PUSH(src); C_PUSH(chr); C_EVALTOS(chr); chr = C_POP(); + src = C_POP(); IND_REMOVE(chr); *dstptr++ = GET_CHAR_VALUE(chr); src = GET_POINTER_ARG1(src,2);
participants (2)
-
Malcolm Wallace
-
Wojciech Moczydlowski, Jr