[GHC] #5688: instance Read Integer/Rational/Double readsPrec out of memory and crash due to exponential notation

GHC cvs-ghc at haskell.org
Thu Jan 12 11:46:31 CET 2012


#5688: instance Read Integer/Rational/Double readsPrec out of memory and crash due
to exponential notation
-------------------------------+--------------------------------------------
  Reporter:  gracjan           |          Owner:                  
      Type:  bug               |         Status:  new             
  Priority:  highest           |      Milestone:  7.4.2           
 Component:  libraries/base    |        Version:  6.12.3          
Resolution:                    |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  Runtime crash     |     Difficulty:  Unknown         
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------

Comment(by maeder):

 A fix should be easy. If the `Rat` constructor is not changed or removed
 it should be at least filled with the fractionals that are given without
 "e" (to allow some user code to go through, although with reduced
 functionality).

 The `Exp` constructor should store the fractional part as `Rational`
 rather than shifting it to an `Integer` an decreasing the exponent.

 A combination of the `Rat` and `Exp` constructores is then essential
 Daniels suggestion `"| RatExp Rational (Maybe Integer)"`.

 An advantage of removing `Rat` would be to better detect code that uses
 it.

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



More information about the Glasgow-haskell-bugs mailing list