aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/base.zc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/base.zc')
-rw-r--r--src/compiler/base.zc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/base.zc b/src/compiler/base.zc
index 7e4b5bc..de699aa 100644
--- a/src/compiler/base.zc
+++ b/src/compiler/base.zc
@@ -980,9 +980,16 @@ int cerr(char* msg) {
}
// how an owner ended, from end_owner's record: the use, the owner, what ended it and where.
// "r: used after it was given away; r borrows t, and t was freed on line 5 (t declared on line 4)"
-int ended_message(char* use, word info, char* root, int cause) {
+int ended_message(char* use, word info, char* root, int cause, int own) {
char* owner = root; int why = 0; char* whom = 0;
if (info) { owner = info[0]; why = info[3]; whom = info[4]; dg_related(info[5], info[1], why, owner); }
+ if (why == 9) {
+ rt.put_s(use); rt.put_s(": ");
+ if (rt.eq_w(use, owner)) rt.put_s("was freed");
+ else { if (own) rt.put_s("belongs to "); else rt.put_s("borrows from "); rt.put_s(owner); rt.put_s(", which was freed"); }
+ rt.put_s(" at the end of its block (line "); rt.put_n(cause & 0xFFFFFF); rt.put_c(')');
+ return 0;
+ }
rt.put_s(use); rt.put_s(": used after it was given away; ");
if (!rt.eq_w(use, owner)) { rt.put_s(use); rt.put_s(" borrows "); rt.put_s(owner); rt.put_s(", and "); }
rt.put_s(owner);
@@ -1008,7 +1015,7 @@ int cerrn(int i, char* msg) {
if (!info && local_end_info) info = local_end_info[root];
if (info) cause = info[2]; else if (local_ended) cause = local_ended[root];
}
- if (cause && !panic && !dry) { errat(); dg_place(lreadpos[i]); ended_message(lname[i], info, lname[root], cause); errend(); }
+ if (cause && !panic && !dry) { errat(); dg_place(lreadpos[i]); ended_message(lname[i], info, lname[root], cause, lown[i]); errend(); }
else serrn(lname[i], msg);
}
return 0;