From 459b7661aaa0d65d01be064bd4b9976c4f045a5c Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 18:22:04 +0330 Subject: bounds: body scan, loop-entry hoisting, pointer proofs from requested size, --explain-checks v1 (non-o3 code) --- tests/programs/explain_checks.expected | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/programs/explain_checks.expected (limited to 'tests/programs/explain_checks.expected') diff --git a/tests/programs/explain_checks.expected b/tests/programs/explain_checks.expected new file mode 100644 index 0000000..c57652a --- /dev/null +++ b/tests/programs/explain_checks.expected @@ -0,0 +1,8 @@ +{"version":1} +{"file":"","line":6,"col":32,"end_line":6,"end_col":35,"fn":"g","kind":"pointer","loop_depth":0,"reason":"size-unknown","fix":"the compiler does not know the size of the block; allocate it here with a constant size, or index a fixed array"} +{"file":"","line":12,"col":35,"end_line":12,"end_col":38,"fn":"main","kind":"index","loop_depth":1,"reason":"hoisted-to-loop-entry","fix":"checked once when the loop starts, and on every access only if that check fails; nothing to do"} +{"file":"","line":13,"col":37,"end_line":13,"end_col":40,"fn":"main","kind":"index","loop_depth":1,"reason":"bound-not-invariant","fix":"the loop body changes the index, the bound or the array, takes an address or makes a closure; keep them fixed inside the loop"} +{"file":"","line":14,"col":11,"end_line":14,"end_col":14,"fn":"main","kind":"index","loop_depth":0,"reason":"index-not-loop-variable","fix":"index with the variable of a loop for (i = 0; i < bound; i++), or mark the code unbounded if the index is known to be in range"} +{"file":"","line":15,"col":35,"end_line":15,"end_col":38,"fn":"main","kind":"pointer","loop_depth":1,"reason":"hoisted-to-loop-entry","fix":"checked once when the loop starts, and on every access only if that check fails; nothing to do"} +{"file":"","line":16,"col":37,"end_line":16,"end_col":40,"fn":"main","kind":"pointer","loop_depth":1,"reason":"pointer-may-be-freed","fix":"the loop body calls something that might free or resize the block; move the call out of the loop"} +{"file":"","line":17,"col":35,"end_line":17,"end_col":38,"fn":"main","kind":"index","loop_depth":1,"reason":"index-not-len-derived","fix":"bound the loop with len() of the array, or with a constant no larger than its length"} -- cgit v1.2.3