aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 15:55:01 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 15:55:01 +0330
commit39857ceb4ece09eb739fe17895ec807e3e04f602 (patch)
treea02eb87d9b9c05d999376544d45e93d94d7f03e8
parentunary: u*x, m*x, d*x are not recasts when the tag names a visible local (spec... (diff)
casts: a cast clears the byte-string flag unless the type is bstr, so (int*)s indexes words
-rw-r--r--src/compiler/expr.zc1
-rw-r--r--tests/conformance/known.txt1
2 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/expr.zc b/src/compiler/expr.zc
index c0e9c91..3829ecf 100644
--- a/src/compiler/expr.zc
+++ b/src/compiler/expr.zc
@@ -1534,6 +1534,7 @@ int unary() {
else if (xfloat && isnum(t)) { op(OP_F2I); xfloat = 0; }
else xfloat = 0;
if (tbytes(t) && !samesz(t, xty)) { tnorm(t); xconst = 0; } // (u8)x cuts the value to size
+ xstr = t == tbstr; // (int*)s is a word pointer, not a byte string
if_value = 0;
xty = t; lv = 0; lvk = LV_NONE; xzero = 0; xbor = -1;
return C_PLAIN;
diff --git a/tests/conformance/known.txt b/tests/conformance/known.txt
index 94d7869..18492fd 100644
--- a/tests/conformance/known.txt
+++ b/tests/conformance/known.txt
@@ -1,6 +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
-1-source/lit_bstr_cast_to_int_pointer.zc zy a the bstr flag leaks into an int* local, so p[0] reads a byte
2-types/typecheck_off_void_return_value_ok.zc zy a void f() { return 3; } yields 3, not 0 (spec 4.8.3)
3-expressions/call_24_parameters.zc zy a the parameter limit is 23, not 24 (decl.zc; closures 19)
3-expressions/call_24_parameters_prototype.zc zy a the parameter limit is 23, not 24 (decl.zc; closures 19)