From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 585F83942014; Mon, 7 Dec 2020 16:56:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 585F83942014 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98126] -Wsequence-point is non-linear for certain cases Date: Mon, 07 Dec 2020 16:56:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: compile-time-hog 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: mpolacek 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 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: Mon, 07 Dec 2020 16:56:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98126 --- Comment #2 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:1cac89da2cb1f2a7c2d93f7f325484c2d1619ca8 commit r11-5826-g1cac89da2cb1f2a7c2d93f7f325484c2d1619ca8 Author: Marek Polacek Date: Thu Dec 3 18:35:00 2020 -0500 c-family: Fix hang with -Wsequence-point [PR98126] verify_sequence_points uses verify_tree to recursively walk the subexpressions of an expression, and while recursing, it also keeps lists of expressions found after/before a sequence point. For a large expression, the list can grow significantly. And merge_tlist is at least N(n^2): for a list of length n it will iterate n(n -1) times, and call candidate_equal_p each time, and that can recurse further. warn_for_collision also has to go through the whole list. With a large-enough expression, the compilation can easily get stuck here for 24 hours. This patch is a simple kludge: if we see that the expression is overly complex, don't even try. gcc/c-family/ChangeLog: PR c++/98126 * c-common.c (verify_tree_lim_r): New function. (verify_sequence_points): Use it. Use nullptr instead of 0. gcc/testsuite/ChangeLog: PR c++/98126 * g++.dg/warn/Wsequence-point-4.C: New test.=