From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 16CD238582B4; Thu, 1 Feb 2024 14:17:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16CD238582B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706797057; bh=XjbZgSqBBI0M2G/23JeF+jqVnlGD6zKd/Piz9xmf3uU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SG5BPMD7p5dCc2XSFZ8TdnQfN54Xzm5yTMxBoIFyUxWI0LWmNuSzmC+n1a6dzTsdQ +aL7j/1V9Nva84lKF9Zy1rNUT92t5RuKfYJ6aO5wleMSvzxBUlnRqaiKzWRMSoLbFb E9KMYHCH+Gswh/Sd4HHMxAmGxd2TL11bKCCX5njw= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/105608] [11/12/13/14 Regression] ICE: in linemap_add with a really long defined macro on the command line r11-338-g2a0225e47868fbfc Date: Thu, 01 Feb 2024 14:17:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 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=3D105608 --- Comment #15 from GCC Commits --- The master branch has been updated by Lewis Hyatt : https://gcc.gnu.org/g:019dc63819befb2b82077fb2d76b5dd670946f36 commit r14-8698-g019dc63819befb2b82077fb2d76b5dd670946f36 Author: Lewis Hyatt Date: Wed Jan 31 15:50:11 2024 -0500 libcpp: Stabilize the location for macros restored after PCH load [PR105608] libcpp currently lacks the infrastructure to assign correct locations to macros that were defined prior to loading a PCH and then restored afterwards. While I plan to address that fully for GCC 15, this patch improves things by using at least a valid location, even if it's not the best one. Without this change, libcpp uses pfile->directive_line as the location for the restored macros, but this location_t applies to the old line map, not the one that was just restored from the PCH, so the resul= ting location is unpredictable and depends on what was stored in the line ma= ps before. With this change, all restored macros get assigned locations at= the line of the #include that triggered the PCH restore. A future patch will store the actual file name and line number of each definition and then synthesize locations in the new line map pointing to the right place. gcc/c-family/ChangeLog: PR preprocessor/105608 * c-pch.cc (c_common_read_pch): Adjust line map so that libcpp assigns a location to restored macros which is the same location that triggered the PCH include. libcpp/ChangeLog: PR preprocessor/105608 * pch.cc (cpp_read_state): Set a valid location for restored macros.=