https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120542
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Gaius Mulley <ga...@gcc.gnu.org>: https://gcc.gnu.org/g:16ab791531ec16fd4596a25efbe6b42e6c16171f commit r16-1251-g16ab791531ec16fd4596a25efbe6b42e6c16171f Author: Gaius Mulley <gaiusm...@gmail.com> Date: Fri Jun 6 10:46:48 2025 +0100 PR modula2/120542: Return statement in the main procedure crashes the compiler The patch checks whether a return statement is allowed. It also checks to see that a return expression is allowed. gcc/m2/ChangeLog: PR modula2/120542 * gm2-compiler/M2Quads.mod (BuildReturnLower): New procedure. (BuildReturn): Allow return without an expression from module initialization blocks. Generate an error if an expression is provided. Call BuildReturnLower if no error was seen. gcc/testsuite/ChangeLog: PR modula2/120542 * gm2/iso/fail/badreturn.mod: New test. * gm2/iso/fail/badreturn2.mod: New test. * gm2/iso/pass/modulereturn.mod: New test. * gm2/iso/pass/modulereturn2.mod: New test. Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>