https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115111
--- 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:5ed0564f2879db35106272556ba91f028177c5cd commit r15-8074-g5ed0564f2879db35106272556ba91f028177c5cd Author: Gaius Mulley <gaiusm...@gmail.com> Date: Sun Mar 16 15:56:48 2025 +0000 PR modula2/115111 Incorrect line debugging locations at the end of the WHILE loop This fix corrects the END token position used during the GotoOp at the bottom of the WHILE loop. The fix is to pass the relative token position down to M2Quads. This method should be replicated for the other loops END or UNTIL keywords and possibly the END statements for conditional statements. gcc/m2/ChangeLog: PR modula2/115111 * gm2-compiler/M2GenGCC.mod (CodeStatementNote): Add debugging. * gm2-compiler/M2Quads.def (BuildEndWhile): New parameter reltokpos. * gm2-compiler/M2Quads.mod (BuildEndWhile): Reimplement using new parameter. * gm2-compiler/P3Build.bnf (WhileStatement): Call BuildEndWhile with -1 relative position. * gm2-gcc/m2block.cc (do_add_stmt): Tidy comment. (GetGlobals): Ditto. (flush_pending_note): Remove #if 0 code. * gm2-gcc/m2pp.cc (m2pp_nop_expr): New function. (m2pp_statement): New case clause call m2pp_nop_expr. gcc/testsuite/ChangeLog: PR modula2/115111 * gm2/pim/pass/whilestep.mod: New test. Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>