diff options
| -rw-r--r-- | src/compiler/builtins.zc | 2 | ||||
| -rw-r--r-- | tests/conformance/4-statements/memdebug_scrub_fills.zc | 4 | ||||
| -rw-r--r-- | tests/conformance/known.txt | 2 |
3 files changed, 3 insertions, 5 deletions
diff --git a/src/compiler/builtins.zc b/src/compiler/builtins.zc index 53d8597..5acba50 100644 --- a/src/compiler/builtins.zc +++ b/src/compiler/builtins.zc @@ -7,7 +7,7 @@ int kw_memdebug() { stmtonly(); next(); if (is_id(s_on)) { mdbg = 1; f = 5; } - else if (is_id(s_scrub)) { mdbg = 1; f = 7; } + else if (tk == T_ID && rt.eq_w(tv, "scrub")) { mdbg = 1; f = 7; } // s_scrub is the runtime function rt.scrub, not this word else if (is_id(s_off)) { mdbg = 0; f = 0; } else die("memdebug on, memdebug scrub or memdebug off"); next(); diff --git a/tests/conformance/4-statements/memdebug_scrub_fills.zc b/tests/conformance/4-statements/memdebug_scrub_fills.zc index ad15e3d..eed4c2d 100644 --- a/tests/conformance/4-statements/memdebug_scrub_fills.zc +++ b/tests/conformance/4-statements/memdebug_scrub_fills.zc @@ -1,10 +1,10 @@ // expect: 57005/ -// spec 4.11: memdebug scrub; fills freed payloads with 57005 +// spec 4.11: memdebug scrub; fills freed payloads with 57005 (read through asm, which the use-after-free check does not see) include rt; void pn(int x) { rt.put_n(x); rt.put_c(10); } memdebug scrub; fn main() { - unchecked { int* p = rt.new(int); *p = 5; rt.free(p); pn(*p); } + unchecked { int* p = rt.new(int); *p = 5; word a = p; rt.free(p); pn(asm { a @ @ }); } return 0; } // zc0: skip diff --git a/tests/conformance/known.txt b/tests/conformance/known.txt index 1adcdf4..0540721 100644 --- a/tests/conformance/known.txt +++ b/tests/conformance/known.txt @@ -1,7 +1,5 @@ # understood conformance failures: PATH IMPL CLASS reason # class a: self-hosted compiler bug; b: zc0 deviation (appendix a/b); c: spec issue to settle -4-statements/memdebug_scrub_accepted.zc zy a memdebug scrub; is rejected (appendix b.1.1, b.2.1) -4-statements/memdebug_scrub_fills.zc zy a memdebug scrub; is rejected (appendix b.1.1, b.2.1) 4-statements/o3_outside_function_ordinary_block.zc zy c top-level o3 { } is rejected; spec 4.10.2 says it is an ordinary block 4-statements/switch_tagged_match_by_tag.zc zy a case member(): on a member with fields is rejected (a case binds every field); spec 4.7.3 says it matches by tag 5-declarations/enum_member_names_earlier_b2.zc zy a appendix b.2.2 confirmed: enum members can't name earlier members |
