From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 336A4385840D; Mon, 11 Mar 2024 15:22:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 336A4385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710170546; bh=hIVyBd6pSwpr9TV4LUIutvcsVEpT4SV2z4NfaF0gXCI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LBo15edZ+C6uNa/GdC3eE8a+a7s6RCYMM1bmYKy0fDEPAF+9TznhNK4/QHN00tPM3 F4QgBVQTqIlI3NdgRYoULsxX0fj+Jb7K5EhpfCiGQXDUHRBUDo7azg/f6LuaBCl8hL eWNG70zMKmch9eY9V43sM1awR55VbjG9oX0vceU4= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/114295] incorrect error location if attempting to compile implementation module without a definition module Date: Mon, 11 Mar 2024 15:22:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: modula2 X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: gaius at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114295 --- Comment #2 from GCC Commits --- The master branch has been updated by Gaius Mulley : https://gcc.gnu.org/g:8410402272038aae7e4b2bd76df38607a78cad95 commit r14-9429-g8410402272038aae7e4b2bd76df38607a78cad95 Author: Gaius Mulley Date: Mon Mar 11 15:21:42 2024 +0000 PR modula2/114295 Incorrect location if compiling implementation without definition This patch fixes a bug which occurred if gm2 was asked to compile an implementation module and could not find the definition module. The er= ror location would be set to the SYSTEM module. The bug occurred as the module sym was created during the peep phase after which the few tokens= are destroyed and recreated during parsing. The bug fix is to call PutDeclared when the module is encountered during parsing which updates the tokenno associated with the module. gcc/m2/ChangeLog: PR modula2/114295 * gm2-compiler/M2Batch.mod (MakeProgramSource): Call PutDeclared if the module is known. (MakeDefinitionSource): Ditto. (MakeImplementationSource): Ditto. * gm2-compiler/M2Comp.mod (ExamineHeader): New procedure. (ExamineCompilationUnit): Rewrite. (PeepInto): Rewrite. * gm2-compiler/M2Error.mod (NewError): Remove default call to GetTokenNo. * gm2-compiler/M2Quads.mod (callRequestDependant): Push tokno w= ith Adr. (BuildStringAdrParam): Ditto. (doBuildBinaryOp): Push OperatorPos on the bool stack. (BuildRelOp): Ditto. * gm2-compiler/P2Build.bnf (SetType): Pass set token pos to BuildSetType. (PointerType): Pass pointer token pos to BuildPointerType. * gm2-compiler/P2SymBuild.def (BuildPointerType): Add parameter pointerpos. (BuildSetType): Add parameter setpos. * gm2-compiler/P2SymBuild.mod (BuildPointerType): Add parameter pointerpos. Build combined token and use it when creating a pointer type. (BuildSetType): Add parameter setpos. Build combined token and use it when creating a set type. * gm2-compiler/SymbolTable.mod (DebugUnknownToken): New constan= t. (CheckTok): New procedure function. (MakeProcedure): Call CheckTok. (MakeRecord): Ditto. (MakeVarient): Ditto. (MakeEnumeration): Ditto. (MakeHiddenType): Ditto. (MakeConstant): Ditto. (MakeConstStringCnul): Ditto. (MakeSubrange): Ditto. (MakeTemporary): Ditto. (MakeVariableForParam): Ditto. (MakeParameterHeapVar): Ditto. (MakePointer): Ditto. (MakeSet): Ditto. (MakeUnbounded): Ditto. (MakeProcType): Ditto. Signed-off-by: Gaius Mulley =