Summary
setters like set-cdr! don't invalidate type information
Metadata
- Id: bc66c444965acaf8e62569a9fd6b509963cc2a6d
- Trac id: 803
- Type: defect
- Reporter: sjamaan
- Owner:
- Cc:
- Status: closed
- Component: compiler
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: 4.9.0
- Version: 4.7.x
- Changetime: 2012-09-24 21:47:48 UTC
- Created: 2012-03-17 21:40:29 UTC
- Keywords: scrutinizer, optimizations
Attachments
- bc66c444965acaf8e62569a9fd6b509963cc2a6d/attachments/0001-when-calling-a-possibly-mutatiing-procedure-invalid.patch
Description
The following program, when compiled with specialization, prints #t. It prints #f in all other cases:
#!scm (let ((x (list 'a))) (set-cdr! x x) (print (list? x)))
If possible, set-car! and set-cdr! should have roughly the same effect as set! (and so should vector-set! but I couldn't reproduce a similar error with that, so I guess that's already taken care of, somehow)
I'll look into it in more detail but wanted to create a ticket so we don't forget about this.
Changes and comments
[2012-04-16 15:24:38 UTC] felix wrote:
It looks like `smash-component-types!` needs not only to smash components but also change `list` and `list-of` types to `(pair ...)`, since `set-cdr!` may convert a proper list into an improper one.
[2012-04-21 15:53:25 UTC] felix attached 0001-when-calling-a-possibly-mutatiing-procedure-invalid.patch (description=patch submitted to chicken-hackers)
[2012-04-21 19:13:25 UTC] sjamaan changed status from new to closed
[2012-04-21 19:13:25 UTC] sjamaan set resolution to fixed
[2012-04-21 19:13:25 UTC] sjamaan wrote:
This patch fixes it
[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0
[2012-09-24 21:47:48 UTC] felix wrote:
Milestone 4.8.0 deleted