aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/analyzer.zc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/analyzer.zc')
-rw-r--r--src/compiler/analyzer.zc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/analyzer.zc b/src/compiler/analyzer.zc
index d1f6f3d..34c0a8b 100644
--- a/src/compiler/analyzer.zc
+++ b/src/compiler/analyzer.zc
@@ -389,6 +389,7 @@ int newloc(int n) {
if (if_local) if_local[i] = 0;
if (!local_origin_mask) local_origin_mask = chk_resize(0, 0, loccap); local_origin_mask[i] = 0;
if (!local_cell) local_cell = chk_resize(0, 0, loccap); local_cell[i] = 0;
+ if (!local_dropset) local_dropset = chk_resize(0, 0, loccap); local_dropset[i] = 0;
if (!local_captured) local_captured = chk_resize(0, 0, loccap); local_captured[i] = 0;
if (!local_ended) local_ended = chk_resize(0, 0, loccap); local_ended[i] = 0;
if (!local_end_info) local_end_info = chk_resize(0, 0, loccap); local_end_info[i] = 0;
@@ -920,6 +921,7 @@ int touch(int i) {
// an expression of class c used as a plain value (a lend, an operand). a new
// object can't be used that way, since nothing would own it.
int plainuse(int c) {
+ if (c == C_FRESH && drop_tail == here && fchk && infn) { drop_temporary(); return C_PLAIN; }
if (c == C_FRESH) cerr("a new object can't be used as a plain value; bind it to a name first");
if (c >= C_VAR) touch(c - C_VAR);
return C_PLAIN;
@@ -933,6 +935,7 @@ int szclass(int n) {
// freeing an owned local. one that holds a typed object with no pointer
// fields goes back through recycle_leaf, which knows its class
int freevar(int i) {
+ if (o3on && fchk && ldroppable(i)) cerrn(i, "has drop and can't end inside an o3 region");
if (local_captured && local_captured[i]) { lit(0); laddr(lslot[i]); op(O_ST); return 0; }
vaddr(i); op(O_LD);
if (lleaf[i] && !o3on && !dry && lookup(s_recycle_leaf) >= 0) {
@@ -966,7 +969,7 @@ int exit_vars(int dep, int final) {
// block ends.
int unused_check(int from) {
while (from < nloc) {
- if (fchk && lown[from] && !lused[from] && !(lrskind[from] == RS_PARAM && rt.eq_w(lname[from], "_"))) serrn(lname[from], "owned object is never used");
+ if (fchk && lown[from] && !lused[from] && !ldroppable(from) && !(lrskind[from] == RS_PARAM && rt.eq_w(lname[from], "_"))) serrn(lname[from], "owned object is never used");
from++;
}
return 0;