Opened 4 years ago

Closed 4 years ago

#8661 closed bug (fixed)

Segfault on System.Time during validate

Reported by: Fuuzetsu Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


I was running ‘sh validate’ today (commit d4f0fcf368765ae4aa7ebe914bc2f254026694c8) and I ended up with this error:

cat ghc/ghc.wrapper                                     >> inplace/bin/ghc-stage2
chmod +x                                                     inplace/bin/ghc-stage2
"inplace/bin/ghc-stage2" -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O -Werror -Wall -H64m -O0    -package-name old-time- -hide-all-packages -i -ilibraries/old-time/. -ilibraries/old-time/dist-install/build -ilibraries/old-time/dist-install/build/autogen -Ilibraries/old-time/dist-install/build -Ilibraries/old-time/dist-install/build/autogen -Ilibraries/old-time/include    -optP-include -optPlibraries/old-time/dist-install/build/autogen/cabal_macros.h -package base- -package old-locale- -Wall -XHaskell2010 -O2 -O -dcore-lint -fno-warn-amp  -fno-warn-deprecated-flags  -no-user-package-db -rtsopts      -odir libraries/old-time/dist-install/build -hidir libraries/old-time/dist-install/build -stubdir libraries/old-time/dist-install/build  -dynamic-too -c libraries/old-time/dist-install/build/System/Time.hs -o libraries/old-time/dist-install/build/System/Time.o -dyno libraries/old-time/dist-install/build/System/Time.dyn_o
gmake[1]: *** [libraries/old-time/dist-install/build/System/Time.o] Segmentation fault
gmake[1]: *** Waiting for unfinished jobs....
Writing docs/users_guide/users_guide/ix01.html for index
Writing docs/users_guide/users_guide/index.html for book(users-guide)
cp mk/fptools.css docs/users_guide/users_guide/
gmake: *** [all] Error 2

It built fine when I ran validate just the other day (at least after commit 32002b3dfdfd6a3c6a1a1eb52d8a257b42e17e51).

32-bit Linux Linux misaki 3.12.3-gentoo #2 SMP Sat Dec 7 23:14:57 GMT 2013 i686 Intel(R) Core(TM)2 Duo CPU L7700 @ 1.80GHz GenuineIntel GNU/Linux

Attaching full build log. This is a tree without any local changes.

Change History (7)

comment:1 Changed 4 years ago by Fuuzetsu

Actually, I see that there's a 256KB limit on attachments. You can find the build log at

comment:2 Changed 4 years ago by Fuuzetsu

I'd like to add that the ghc-stage2 binary produced segfaults the moment we try to compile anything with it, be it an invalid Haskell file (garbage string) or a valid program.

comment:3 Changed 4 years ago by Herbert Valerio Riedel <hvr@…>

In a3878d172b358b896b3c8302e58199958479d8e5/integer-gmp:

Temporary disable `mpz_gmpz_tdiv_qr_ui` to workaround #8661

I still need to investigated, but for some reason not yet obvious to me,
commit [af2ba9c8/integer-gmp] (re #8647) seems to have triggered #8661
on linux/32

This commit disables the use of the `quotRemIntegerWord#` primop on
32bit (which seems to trigger the issue).

Signed-off-by: Herbert Valerio Riedel <>

comment:4 Changed 4 years ago by nomeata

I still observe a weridness, ghc spins for a long time trying to compile System.Time. According to -v, it is somewhere in the desugarer – is that possibly related to this ticket or did I hit a different, possibly local, issue?

comment:5 Changed 4 years ago by nomeata

Nevermind, it is only on my branch...

comment:6 Changed 4 years ago by Herbert Valerio Riedel <hvr@…>

In 13b4d0cdd18471de33ba89bda11a4b238507b7c7/integer-gmp:

Drop redundant formal parameter from TAKE1_UL1_RET2

This fixes the actual cause for #8661, i.e. a mismatch between the
actual arity of the Cmm implementation and the arity declared in the
foreign import statement.

This also reverts [a3878d17/integer-gmp] as the workaround isn't needed

Signed-off-by: Herbert Valerio Riedel <>

comment:7 Changed 4 years ago by hvr

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.