From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B50D83850425; Wed, 10 Feb 2021 19:33:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B50D83850425 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/96391] [10/11 Regression] ICE in linemap_compare_locations on "CONST VOID" in large C++ files Date: Wed, 10 Feb 2021 19:33:59 +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: 10.2.1 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.3 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2021 19:33:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96391 --- Comment #20 from CVS Commits --- The master branch has been updated by David Malcolm : https://gcc.gnu.org/g:1f5c80883efce5242d892eb771ebb60830d20e0f commit r11-7179-g1f5c80883efce5242d892eb771ebb60830d20e0f Author: David Malcolm Date: Wed Feb 10 14:33:10 2021 -0500 libcpp: fix ICE comparing macro locations without column info [PR96391] PR preprocessor/96391 describes an ICE in the C++ frontend on: #define CONST const #define VOID void typedef CONST VOID *PCVOID; where the typedef line occurs after enough code has been compiled that location_t values are beyond LINE_MAP_MAX_LOCATION_WITH_COLS, and hence no column numbers are available. The issue occurs in linemap_compare_locations when comparing the locations of the "const" and "void" tokens. Upon resolving the LRK_MACRO_EXPANSION_POINT, both have the same location_t, the line of the "typedef" (with no column), and so the l0 =3D=3D l1 clause is triggered, but they are not from the same macro expansion, leading first_map_in_common to return NULL and triggering the "abort" condition. This patch fixes the issue by checking when the two macro expansion point location_t values are equal that the value <=3D LINE_MAP_MAX_LOCATION_WITH_COLS and thus has column information, fixing the issue. gcc/testsuite/ChangeLog: PR preprocessor/96391 * g++.dg/plugin/location-overflow-test-pr96391.c: New test. * g++.dg/plugin/plugin.exp (plugin_test_list): Add it, using the location_overflow_plugin.c from gcc.dg/plugin. libcpp/ChangeLog: PR preprocessor/96391 * line-map.c (linemap_compare_locations): Require that the location be <=3D LINE_MAP_MAX_LOCATION_WITH_COLS when treating locations as coming from the same macro expansion.=