[GHC] #8854: Missing class method not caught at compile time, program freezes when missing method is called.

GHC ghc-devs at haskell.org
Thu Mar 6 21:28:14 UTC 2014


#8854: Missing class method not caught at compile time, program freezes when
missing method is called.
----------------------------------+----------------------------------
        Reporter:  RaminHAL9001   |            Owner:
            Type:  bug            |           Status:  new
        Priority:  normal         |        Milestone:
       Component:  Compiler       |          Version:  7.6.3
      Resolution:                 |         Keywords:
Operating System:  Linux          |     Architecture:  x86_64 (amd64)
 Type of failure:  Runtime crash  |       Difficulty:  Unknown
       Test Case:                 |       Blocked By:
        Blocking:                 |  Related Tickets:  #7633
----------------------------------+----------------------------------

Comment (by RaminHAL9001):

 My full source code repository is here:
 https://github.com/RaminHAL9001/dao

 You can clone the repository and just run "make" on Linux, it should
 compile fine with GHC 7.6.1. It will produce two executable programs,
 "./dao" and "./debug/test".

 In the "Dao.Interpreter" module, there is an instance:
 {{{
 instance HasRandGen [Comment] where { randO = return []; defaultO = return
 []; }
 }}}
 If you remove the "defaultO" instance and re-compile, that should
 reproduce the bug, This was the exact instance I had not defined that was
 causing it to freeze.

 To run the test suite to cause the error to occur, change to the "debug"
 directory and run the "test" program. It works a bit like QuickCheck, but
 you can specify random seed values on the command line to produce the same
 random test cases every time, for example:
 {{{
 ./test 8 14
 }}}

 I found seeds 8 and 14 crashed reliably, both compiled and in GHCi. But I
 don't know if the random number generator will produce the same test cases
 on your hardware as it will on mine so you may have to run a few dozen
 tests before you find one that freezes.

 {{{
 ./test $(seq 1 100)
 }}}

 The source code is under active development, so things may change. However
 for the time being I don't expect there to be any changes to the part of
 the code that lets you reproduce the bug.

 I did see the {-# MINIMAL #-} pragma in #7633, but I am using GHC 7.6.1
 for now.


 Replying to [comment:1 simonpj]:
 > If you specify the minimal complete definition, using the MINIMAL pragma
 (which is part of 7.8, but not 7.6) then it should warn.  If it doesn't,
 that's a bug.  Can you give the complete source code for a program that
 exhibits the bug... if we can't reproduce it we can't fix it.
 >
 > Thanks
 >
 > Simon

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8854#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list