[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] #1317: fibc hangs when compiled with -O3 or -O4
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] #1317: fibc hangs when compiled with -O3 or -O4 |
Date: |
Sun, 21 Aug 2016 18:30:30 -0000 |
#1317: fibc hangs when compiled with -O3 or -O4
------------------------+--------------------
Reporter: mario | Owner:
Type: defect | Status: new
Priority: major | Milestone: 4.12.0
Component: compiler | Version: 4.11.0
Keywords: fibc, hang |
------------------------+--------------------
The program below hangs eating CPU when compiled with -O3 or -O4:
{{{
(define (addc x y k)
(if (zero? y)
(k x)
(addc (add1 x) (sub1 y) k)))
(define (fibc x c)
(if (zero? x)
(c 0)
(if (zero? (sub1 x))
(c 1)
(addc (call-with-current-continuation (lambda (c) (fibc (sub1 x)
c)))
(call-with-current-continuation (lambda (c) (fibc (sub1 (sub1
x)) c)))
c))))
(let ((x (time (fibc 30 (lambda (n) n)))))
(if (not (equal? x 832040))
(error "wrong result" x) ) )
}}}
{{{
$ csc fibc.scm
$ ./fibc
0.412s CPU time, 12/4237 GCs (major/minor)
}}}
{{{
$ csc -O3 fibc.scm
$ ./fibc
<hangs>
}}}
Also hangs when compiled with -O4. It works as expected (i.e., doesn't
hang) when compiled with -O5.
I could reproduce this behavior with 4.11.0 and master (as of 724f6866b).
I could **not** reproduce the problem with 4.10.0, so the bug has been
introduced at some point between 4.10.0 and 4.11.0. The issue doesn't seem
to be related to the C compiler. I could reproduce it with GCC 4.9.2, GCC
6.1.1 and clang 3.6.2.
This issue was caught while trying csc options for [https://github.com
/mario-goulart/chicken-benchmarks chicken-benchmarks] (fibc is one of the
benchmark programs).
--
Ticket URL: <http://bugs.call-cc.org/ticket/1317>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #1317: fibc hangs when compiled with -O3 or -O4,
Chicken Trac <=