Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#224 closed defect (fixed)

map allows non-list arguments

Reported by: zbigniew Owned by: felix
Priority: critical Milestone:
Component: core libraries Version: 4.4.x
Keywords: Cc:
Estimated difficulty:


If the first list argument to map is not actually a list, map will just return (). Version: git fd66e1b (master)

#;1> (map (lambda (x) x) 'foo)
#;2> (map 'foo 'foo)

Change History (7)

comment:1 Changed 9 years ago by zbigniew

More data points: peter reports the same issue with 4.4.0, while mario (4.4.6) and moritz (4.4.6) find it works correctly.

I used make spotless and rebuilt the compiler with itself and it is still giving this issue. But it doesn't make sense; the code is clear that an error should occur.

Originally this was on 4.4.6 macosx-unix-gnu-x86 but I have now reproduced it from a clean git clone on another platform, 4.4.6 linux-unix-gnu-x86.

comment:2 Changed 9 years ago by zbigniew

As seen at the compiled output appears to be wrong, it appears to be an issue with internal-compiler-syntax on ##sys#map etc. where the argument is only tested for pair?. An error is not thrown for non-lists.

comment:3 Changed 9 years ago by zbigniew

  • Owner set to felix
  • Status changed from new to assigned

Issue also affects for-each. Looks like a straightforward fix but I will let you handle it from here.

comment:4 Changed 9 years ago by zbigniew

mario says galinha is using Chicken 4.2.0 to generate the snapshots, which explains why the snapshot bootstrap files are not affected; this problem was introduced in Chicken 4.2.1.

comment:5 Changed 9 years ago by felix

  • Status changed from assigned to accepted
  • Version set to 4.4.x

comment:6 Changed 9 years ago by felix

  • Resolution set to fixed
  • Status changed from accepted to closed

In 22699fd729e2b1e08e8bdb2d6a5d640382d209d8 (experimental), a check has been added (unless in unsafe mode). Note that this only checks for the arguments being lists, not "proper" lists - the loops terminate on the first non-pair argument found.

comment:7 Changed 8 years ago by felix

  • Milestone 4.6.0 deleted

Milestone 4.6.0 deleted

Note: See TracTickets for help on using tickets.