Changes between Initial Version and Version 13 of Ticket #4321


Ignore:
Timestamp:
Nov 13, 2010 1:00:44 PM (5 years ago)
Author:
igloo
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4321

    • Property Cc daniel.is.fischer@… added
    • Property Test Case changed from to T4321
  • Ticket #4321 – Description

    initial v13  
    11GHC versions affected:
    2    6.13.20100915
    3    6.13.20090922
    4    6.12.1
    5    6.10.4
     2 * 6.13.20100915
     3 * 6.13.20090922
     4 * 6.12.1
     5 * 6.10.4
    66
    77OS versions tested:
    8    OS X Snow Leopard
    9    Ubuntu Linux 9.10 - Karmic Koala
     8 * OS X Snow Leopard
     9 * Ubuntu Linux 9.10 - Karmic Koala
    1010
    1111Description:
     
    1414
    1515The important line of code is this one:
     16{{{
     17h * (sum (map area [1..n]))
     18}}}
     19If you compile the program as it is, with this command:
     20{{{
     21ghc --make -O2 Pi.hs
     22}}}
     23it runs out of stack space when run like so:
     24{{{
     25./Pi 1000000
    1626
    17    h * (sum (map area [1..n]))
    18 
    19 If you compile the program as it is, with this command:
    20 
    21    ghc --make -O2 Pi.hs
    22 
    23 it runs out of stack space when run like so:
    24 
    25    ./Pi 1000000
    26 
    27    Stack space overflow: current size 8388608 bytes.
    28    Use `+RTS -Ksize -RTS' to increase it.
     27Stack space overflow: current size 8388608 bytes.
     28Use `+RTS -Ksize -RTS' to increase it.
     29}}}
    2930
    3031For GHC versions 6.10.4, 6.12.1 and 6.13.20090922
    3132However, if you add what appears to be a superfluous type annotation to the line of code, like so:
    32 
    33    h * ((sum (map area [1..n])) :: Double)
    34 
     33{{{
     34h * ((sum (map area [1..n])) :: Double)
     35}}}
    3536The program runs to completion with no stack overflow:
    36 
    37    ./Pi 1000000
    38    3.1415926535897643
    39 
     37{{{
     38./Pi 1000000
     393.1415926535897643
     40}}}
    4041Indeed it works just fine for even larger inputs.
    4142