[GHC] #11822: Pattern match checker exceeded (2000000) iterations

GHC ghc-devs at haskell.org
Wed Oct 19 17:45:49 UTC 2016


#11822: Pattern match checker exceeded (2000000) iterations
-------------------------------------+-------------------------------------
        Reporter:  j.waldmann        |                Owner:  gkaracha
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1-rc3
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by niteria):

 Is it quadratic even for the simplest case?

 I have `A.gen.sh`:
 {{{
 N=$1
 echo "module A where"
 echo
 echo "data X = X"
 for i in $(seq 1 $N); do echo "  | X$i"; done
 echo
 echo "instance Enum X where"
 for i in $(seq 1 $N); do echo "  toEnum $i = X$i"; done
 for i in $(seq 1 $N); do echo "  fromEnum X$i = $i"; done
 }}}

 Trying to compile for a datatype with 4000 constructors gives me:
 {{{
 $ ./A.gen.sh 4000 > A.hs && ./inplace/bin/ghc-stage2 -dno-debug-output
 A.hs
 [1 of 1] Compiling A                ( A.hs, A.o )

 A.hs:8006:3: warning:
     Pattern match checker exceeded (2000000) iterations in
     an equation for ‘fromEnum’. (Use -fmax-pmcheck-iterations=n
     to set the maximun number of iterations to n)
 }}}

 This is not a made up example, we actually have enumeration types with 10k
 constructors.

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


More information about the ghc-tickets mailing list