https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120542

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Gaius Mulley
<ga...@gcc.gnu.org>:

https://gcc.gnu.org/g:dee5246d7883ed04e1e8c124887f19d5e908595f

commit r15-9989-gdee5246d7883ed04e1e8c124887f19d5e908595f
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Thu Jul 17 13:57:52 2025 +0100

    [PATCH] 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.

    (cherry picked from commit 16ab791531ec16fd4596a25efbe6b42e6c16171f)

    Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>
  • [Bug modula2/120542] Return sta... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to