Mercurial > urweb
annotate tests/functorMania.ur @ 2297:6d56080f495c
Fix a read-after-free bug using a timestamp check
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 19 Nov 2015 13:18:58 -0500 |
parents | 210fb3dfc483 |
children |
rev | line source |
---|---|
adam@1989 | 1 functor F1(M : sig type t end) = struct |
adam@1989 | 2 type t = M.t |
adam@1989 | 3 fun g () : M.t = g () |
adam@1989 | 4 fun f () = g () |
adam@1989 | 5 end |
adam@1989 | 6 functor F2(M : sig type t end) = F1(M) |
adam@1989 | 7 functor F3(M : sig type t end) = F2(M) |
adam@1989 | 8 |
adam@1989 | 9 functor F4(M : sig end) = F1(struct type t = int end) |
adam@1989 | 10 functor F5(M : sig end) = F2(struct type t = int end) |
adam@1989 | 11 functor F6(M : sig end) = F3(struct type t = int end) |
adam@1989 | 12 |
adam@1989 | 13 functor F7(M : sig end) = F1(struct type t = string end) |
adam@1989 | 14 functor F8(M : sig end) = F2(struct type t = string end) |
adam@1989 | 15 functor F9(M : sig end) = F3(struct type t = string end) |
adam@1989 | 16 |
adam@1989 | 17 structure M1 = F1(struct type t = string end) |
adam@1989 | 18 structure M2 = F2(struct type t = string end) |
adam@1989 | 19 structure M3 = F3(struct type t = string end) |
adam@1989 | 20 |
adam@1989 | 21 structure M4 = F4(struct end) |
adam@1989 | 22 structure M5 = F5(struct end) |
adam@1989 | 23 structure M6 = F6(struct end) |
adam@1989 | 24 |
adam@1989 | 25 structure M7 = F7(struct end) |
adam@1989 | 26 structure M8 = F8(struct end) |
adam@1989 | 27 structure M9 = F9(struct end) |
adam@1989 | 28 |
adam@1989 | 29 fun loop x : unit = loop (M1.f (), M2.f (), M3.f (), |
adam@1989 | 30 M4.f (), M5.f (), M6.f (), |
adam@1989 | 31 M7.f (), M8.f (), M9.f ()) |
adam@1989 | 32 |
adam@1989 | 33 fun main () : transaction page = |
adam@1989 | 34 x <- error <xml/>; |
adam@1989 | 35 u <- return (loop x); |
adam@1989 | 36 return <xml/> |