Critical bug found ("stack-use-after-scope").

This commit is contained in:
Erik Svedäng 2018-03-07 15:13:42 +01:00
parent 20a98ba617
commit 745a47cd70
2 changed files with 8 additions and 9 deletions

View File

@ -8,6 +8,7 @@
## Critical Bugs
* [0.3] References must keep track of their origin and prevent usage of them if the origin has been given away.
* [0.3] Initilization of globals must happen in correct order.
* [0.3] Can set a ref so it points to a value in a more short-lived scope, leads to 'stack-use-after-scope' error in clang-sanitizer.
## Big Language Features
* [0.3] The array should use a more efficient re-allocation scheme, a la http://en.cppreference.com/w/cpp/container/vector

View File

@ -30,15 +30,6 @@
;; (do (String.delete s)
;; (IO.println r))))
;; Using the (Fn (String String) Bool) version of '=' can lead to memory error?
;; It takes ownership over the strings but while fails to detect the double use.
(defn main []
(let [s @"hej"]
(while (/= s @"svej")
(do
;;(String.delete s)
(set! s @"svej")))))
;; ;; This crashes the compiler:
;; (defn x [a] (the Inthdfdf a))
@ -47,3 +38,10 @@
;; (let [s @"hej"]
;; (do (delete s)
;; s)))
;; Setting ref to value in short-lived scope
(defn main []
(let-do [r &[1 2 3]]
(let [xs [4 5 6]]
(set! r &xs))
(println* r)))