aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/4-statements
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 16:03:48 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 16:03:48 +0330
commit29eb9e50d33d417035e133dcebb7111074a23b24 (patch)
treeda4a1614bae228dc0b7675b287643c64e8720530 /tests/conformance/4-statements
parentmerge: llvm auto-build (opt-in on x86-64), mode stamp (diff)
parentconformance: b.2.8 is documented behavior; keep the conformance run out of te... (diff)
merge: seven self-hosted compiler fixes from conformance
Diffstat (limited to 'tests/conformance/4-statements')
-rw-r--r--tests/conformance/4-statements/memdebug_scrub_fills.zc4
-rw-r--r--tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc15
2 files changed, 17 insertions, 2 deletions
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/4-statements/switch_tagged_empty_parens_with_fields.zc b/tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc
new file mode 100644
index 0000000..789c650
--- /dev/null
+++ b/tests/conformance/4-statements/switch_tagged_empty_parens_with_fields.zc
@@ -0,0 +1,15 @@
+// expect: rect/circle/
+// spec 4.7.3: case member(): with no names matches by tag even when the member has fields
+include rt;
+enum shape { circle { int r; }, rect { int w; int h; }, dot };
+void t(shape* s) {
+ switch (s) { case circle(): rt.put_s("circle"); case rect(): rt.put_s("rect"); case dot: rt.put_s("dot"); }
+ rt.put_c(10);
+}
+fn main() {
+ shape* a = shape.rect(4, 5); shape* b = shape.circle(2);
+ t(a); t(b);
+ rt.free(a); rt.free(b);
+ return 0;
+}
+// zc0: skip