Opened 13 years ago

Last modified 11 years ago

#876 closed enhancement

csi segfaults immediately when running this code — at Version 1

Reported by: Christian Kellermann Owned by:
Priority: minor Milestone:
Component: core tools Version: 4.7.x
Keywords: csi segfault master Cc:
Estimated difficulty:

Description (last modified by Christian Kellermann)

As found by uman on IRC the following works when compiled and crashes when interpreted:

(define (product-rec f a next b)
  (if (> a b) 1
      (* (f a) (product-rec f (next a) next b))))

(define (estimate-pi n)
  (define (num-term k)
    (+ k (if (even? k) 2 1)))
  (define (denom-term k)
    (+ k (if (even? k) 1 2)))
  (* 4 (product-rec (lambda (k) (/ (num-term k) (denom-term k))) 1 add1 n)))

(print (estimate-pi 100000))

This crashes current master, on x64 linux, also 4.7.0 on 32bit x86 OpenBSD

Change History (1)

comment:1 Changed 13 years ago by Christian Kellermann

Description: modified (diff)
Note: See TracTickets for help on using tickets.