From 98ef8bc4dfcebe44eece933ff0affc776b7199dd Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 15:12:43 +0000 Subject: fix(codegen): raise a runtime error when a FUNCTION ends without RETURN Report the function and its header line, then throw, instead of silently returning zero. FUNCTION MAIN keeps its implicit result. Co-Authored-By: Claude Sonnet 5.5 --- doc/language/keyword/cpsc-keyword-function.7.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/language/keyword/cpsc-keyword-function.7.md b/doc/language/keyword/cpsc-keyword-function.7.md index a7de9a4..d49a07d 100644 --- a/doc/language/keyword/cpsc-keyword-function.7.md +++ b/doc/language/keyword/cpsc-keyword-function.7.md @@ -15,7 +15,7 @@ ENDFUNCTION # DESCRIPTION -Call a function in an expression as `name(arguments)`. A call may precede its top-level definition. RETURNS specifies the result type; omitting it defaults to INTEGER. RETURN supplies a value of that type. Whole-array results are unsupported. +Call a function in an expression as `name(arguments)`. A call may precede its top-level definition. RETURNS specifies the result type; omitting it defaults to INTEGER. RETURN supplies a value of that type. If execution reaches ENDFUNCTION without a RETURN, a run-time error is reported and an exception is thrown (the top-level MAIN is exempt). Whole-array results are unsupported. As a compiler extension, `name(arguments)` may also be a complete statement that discards the result. This differs from guide section 8.2, which requires function calls to occur within expressions. Built-in functions support the same form. -- cgit v1.3.1-4-g156e