From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 140D0385841E; Sat, 27 Jan 2024 04:30:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 140D0385841E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706329825; bh=aTj6H2fBr7acgqkveJGfcTeUknq6WwmiodGMObn9hUA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rBTKaxzHyCe0/DgNnupCZCTvdzi6JqpwSfVIiFlU8RM/RcNO5THgxqHPwkcbccvT8 bNxsLw+SMubQRZu0MeEYXuTONyXER68LW4W+YETbpjZAZzqsmIhbB7ub/5wnXSlS6I o9pQ77JqRXzebh7sL5OlZPE2h78uqZnzHNLtiQc0= 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: Sat, 27 Jan 2024 04:30:23 +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: ice-on-valid-code, 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 #5 from GCC Commits --- The master branch has been updated by Lewis Hyatt : https://gcc.gnu.org/g:5200ef26ac1771a75596394c20c5f1a348694d5e commit r14-8465-g5200ef26ac1771a75596394c20c5f1a348694d5e Author: Lewis Hyatt Date: Tue Dec 5 11:33:39 2023 -0500 c-family: Fix ICE with large column number after restoring a PCH [PR105= 608] Users are allowed to define macros prior to restoring a precompiled hea= der file, as long as those macros are not defined (or are defined identical= ly) in the PCH. However, the PCH restoration process destroys all the macro definitions, so libcpp has to record them before restoring the PCH and = then redefine them afterward. This process does not currently assign great locations to the macros af= ter redefining them. Some work is needed to also remember the original locations and get the line_maps instance in the right state (since, like all other data structures, the line_maps instance is also reset after restoring a PCH). The new testcase line-map-3.C contains XFAILed examples where the locat= ions are wrong. This patch addresses a more pressing issue, which is that we ICE in some cases since GCC 11, hitting an assert in line-maps.cc. It happens if the first line encountered after the PCH restore requires an LC_RENAME map, such as will happen if the line is sufficiently long. This is much easier to fix, since we just need to call linemap_line_start before asking libcpp= to redefine the stored macros, instead of afterward, to avoid the unexpect= ed need for an LC_RENAME before an LC_ENTER has been seen. gcc/c-family/ChangeLog: PR preprocessor/105608 * c-pch.cc (c_common_read_pch): Start a new line map before ask= ing libcpp to restore macros defined prior to reading the PCH, inst= ead of afterward. gcc/testsuite/ChangeLog: PR preprocessor/105608 * g++.dg/pch/line-map-1.C: New test. * g++.dg/pch/line-map-1.Hs: New test. * g++.dg/pch/line-map-2.C: New test. * g++.dg/pch/line-map-2.Hs: New test. * g++.dg/pch/line-map-3.C: New test. * g++.dg/pch/line-map-3.Hs: New test.=