https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114520
--- Comment #4 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:aeee63ffbf4f4fbc4d90d8aae808d6b67f0148a3 commit r14-9710-gaeee63ffbf4f4fbc4d90d8aae808d6b67f0148a3 Author: Gaius Mulley <gaiusm...@gmail.com> Date: Thu Mar 28 16:49:44 2024 +0000 PR modula2/114520 Incorrect ordering of import/export statements cause confusion The error recovery causes misleading error messages to appear if an EXPORT and IMPORT statement are in the wrong order. This patch detects the incorrect order and issues an error message and prevents error recovery. The fix should be improved and made more general if another similar case is required. gcc/m2/ChangeLog: PR modula2/114520 * gm2-compiler/P0SyntaxCheck.bnf (DetectImport): New procedure. (EnableImportCheck): New boolean. (Expect): Call DetectImport. (Export): Set EnableImportCheck TRUE before ';' and FALSE afterwards. Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>