At the moment I'm trying to hunt down a probably GC-related bug in
ghc-4.03 from CVS, but I'm not totally sure if this is the real reason
for some extremely strange segmentation faults. So, in an act of total
despair, I've tried to build a ghc with the flags -DDEBUG -optc-DDEBUG
and bootstrap itself. Some observations:
* There are some small bugs in fptools/ghc/includes/PrimOps.h,
patch appended, though I'm not very sure about changing
ARR_PTRS_info to MUT_ARR_PTRS_FROZEN_info.
* In the bootstrapping phase there are about 100 warnings like
WARNING: file rename/RnIfaces.lhs line 321 Type!Kind{-r3Z8,j-}
* During compilation of my program (with -DDEBUG -optc-DDEBUG)
renameSourceCode gives a lot of warnings. Some examples:
Note: renameSourceCode found warnings
GL_Misc.hs:65: Warning: Defined but not used: cmp_eq{-r4Gf-}
(This seems to happen for every constructor with an associated
"deriving (Eq,Ord)")
Note: renameSourceCode found warnings
<compiler-generated-code>:
Warning: definition but no type signature for
`con2tag_Bufferzh{-r4oB-}'
(For every type with "deriving (Eq,Ord)")
Note: renameSourceCode found warnings
Foo.hs:58: Warning: Defined but not used: a{-r5Bt-}
(This is somehow "deriving Show"-related.)
* All the barfs handling unexpected cases in fptools/ghc/rts should
print the value which the enclosing switch doesn't handle. This
would make debugging easier...
The reason for all this hassle is that some of my HOpenGL examples raise
a segmentation fault from time to time. Changing the source code *very*
slightly, using a two-space collector (+RTS -G1), using +RTS -Z, varying
the stack and/or heap sizes, etc. result in a large variety of runtime
errors:
Segmentation Fault
ASSERTION FAILED: file GC.c, line 2779
relocate_TSO
scavenge_mut_list: strange object?
My current suspects are mutable byte arrays which survive a few GCs, but
this is currently only a wild guess.
To be continued...
Cheers,
Sven
--
Sven Panne Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen Oettingenstr. 67
mailto:[EMAIL PROTECTED] D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne
diff -rc -x CVS fptools.orig/ghc/includes/PrimOps.h fptools/ghc/includes/PrimOps.h
*** fptools.orig/ghc/includes/PrimOps.h Wed Apr 28 09:28:58 1999
--- fptools/ghc/includes/PrimOps.h Mon May 3 13:54:32 1999
***************
*** 473,483 ****
#ifdef DEBUG
#define BYTE_ARR_CTS(a) \
! ({ ASSERT(GET_INFO(a) == &ARR_WORDS_info); \
REAL_BYTE_ARR_CTS(a); })
#define PTRS_ARR_CTS(a) \
! ({ ASSERT((GET_INFO(a) == &ARR_PTRS_info) \
! || (GET_INFO(a) == &MUT_ARR_PTRS_info)); \
REAL_PTRS_ARR_CTS(a); })
#else
#define BYTE_ARR_CTS(a) REAL_BYTE_ARR_CTS(a)
--- 473,483 ----
#ifdef DEBUG
#define BYTE_ARR_CTS(a) \
! ({ ASSERT(GET_INFO((StgArrWords *)(a)) == &ARR_WORDS_info); \
REAL_BYTE_ARR_CTS(a); })
#define PTRS_ARR_CTS(a) \
! ({ ASSERT((GET_INFO((StgMutArrPtrs *)(a)) == &MUT_ARR_PTRS_FROZEN_info) \
! || (GET_INFO((StgMutArrPtrs *)(a)) == &MUT_ARR_PTRS_info)); \
REAL_PTRS_ARR_CTS(a); })
#else
#define BYTE_ARR_CTS(a) REAL_BYTE_ARR_CTS(a)