From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6680A385840B; Sat, 27 Jan 2024 21:51:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6680A385840B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706392263; bh=lU1byd0x7Q18hLzZSgo2phI1gg/rYvb7bvGbQ2BQTQY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VtAfITk2cCAKoKbwclPuZ6QR9sIStlWQF0gxRBhtr3CNhLikMp+BL02/182DcdYBm d6MZdyeNxdLn2bpaEcG7RZYGr27RbKzOcKUrKE0JvNQqz2xwRkb/cx+SKHHQpO5vjw d4RyTnpy+AJIHSTG53E8o0DpesLexQqCHnxDZ6yg= 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 21:51:02 +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 #8 from GCC Commits --- The releases/gcc-13 branch has been updated by Lewis Hyatt : https://gcc.gnu.org/g:52029ef151cc9b1c90fa620079fc17f3960c467c commit r13-8257-g52029ef151cc9b1c90fa620079fc17f3960c467c 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.=