Skip to content

Commit

Permalink
fix crash when vector is nil by treating nil as vector of size 0
Browse files Browse the repository at this point in the history
  • Loading branch information
melvinzhang committed Jun 4, 2017
1 parent 236bf8a commit 004f02d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scheme2llvm.scm
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ define fastcc i64 @main(i32 %argc, i8** %argv) {
(init-vector! (malloc (add raw-size 2)) raw-size))

(llvm-define (vector-size vector)
(load (getelementptr vector 1)))
(if (null? vector) 0 (load (getelementptr vector 1))))

(llvm-define (vector-ref vector raw-index)
;(display "; vector-ref:")
Expand Down

0 comments on commit 004f02d

Please sign in to comment.