cp0 may introduce uninitialized references when lifting letrec RHS bindings
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- compilers
Research direction
Start by building Chez and running the #!chezscheme reproducer in the issue, comparing the two schedules (full run-cp0 versus opt (#%$cp0 tree)) to confirm the vector/void divergence. Then read the cp0-rec-let handling together with split-value to see where an eager let binding is lifted out of a letrec right-hand side and merged into the enclosing nonsequential letrec; the fix must preserve the original initialization order. Done means the reproducer yields the same result for both schedules and the cp0 mat tests still pass.
Written by the indexing model from the issue text.
Description
cp0 may incorrectly lift an eager binding from a letrec RHS and merge it into the enclosing nonsequential letrec.
For example, a transformation resembling:
(letrec ([x (let ([a E]) (f a))]) body)
into:
(letrec ([a E] [x (f a)]) body)
introduces an initialization dependency that was not present in the original program. The reference to a in the RHS of x is now potentially uninitialized.
The issue appears to involve split-value and the merging of lifted bindings in cp0-rec-let.
eg.
#!chezscheme
(import (chezscheme))
(define src
'(lambda (u v)
(letrec ([x (let ([a (vector (lambda () x))])
(if (eq? a u) (eq? a v) a))])
x)))
(define (check schedule)
(parameterize ([optimize-level 2] [run-cp0 schedule])
(let ([result ((compile src (environment '(chezscheme))) #f #f)])
(cond [(vector? result) 'vector] [(eq? result (void)) 'void] [else result]))))
(write (list (check (run-cp0)) (check (lambda (opt tree) (opt (#%$cp0 tree))))))
- Dominant language
- Scheme
- Stars
- 7.4k
- Forks
- 1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 19
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cisco/ChezScheme
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
cisco/ChezScheme#1110 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
cisco/ChezScheme#1101 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
cisco/ChezScheme#1078 · 1 comment ·
Maintainers usually reply within 1 day
-
RFC: solution to clangd not finding "scheme.h"Possibly taken @reginaldalfret claimed this 20 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
cisco/ChezScheme#1073 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
cisco/ChezScheme#1063 ·
Maintainers usually reply within 1 day
All issues in cisco/ChezScheme
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 82/100
supercollider/supercollider#7872 · 1 comment ·
Maintainers usually reply within 1 day
-
bug I/O low priority semantics
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
pocket-stack/pocketjs#729 ·
-
[BUG]: C# programs with top-level statements fail to compilePossibly taken @AsyncNigam claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
compiler-explorer/compiler-explorer#9625 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
baseballyama/rsvelte#5086 ·
Maintainers usually reply within 1 day