From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EF6D5385E004; Thu, 26 Mar 2020 08:19:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF6D5385E004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585210765; bh=ObWd8ZuGcQZyOQcrh9pmiIOFLHFikXTT8hWptsRDOGo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uq2uDzsqwpA+jqXRHL6+J0e6+pDtY90fQeuxPzRDiJ493OyfjFaRmUotnAcBOHaPW KAcyz4lkyvgwQMQsA3ZRdReFQyHrbljD6BBD66AxviFtSgNMdGkYatpZ6ealtmI3KV Qi0xd3nh56yhNx9iIRF1bT/2gw6as6GxVlwU+yc0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241 Date: Thu, 26 Mar 2020 08:19:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: 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: 8.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 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: Thu, 26 Mar 2020 08:19:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94272 --- Comment #5 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:5a1706f63a2024a5c2d878f2efeb8d198214542f commit r10-7393-g5a1706f63a2024a5c2d878f2efeb8d198214542f Author: Jakub Jelinek Date: Thu Mar 26 09:18:35 2020 +0100 c++: Fix a -fcompare-debug issue with DEBUG_BEGIN_STMT stmts in STATEMENT_LISTs [PR94272] The following testcase FAILs with -fcompare-debug. The problem is that the C++ FE initially uses IF_STMTs, tcc_statement which default to TREE_SIDE_EFFECTS set, but later on is genericized into COND_EXPRs, tcc_expression which default to TREE_SIDE_EFFECTS ored from all 3 opera= nds. Furthermore, with -g we emit by default DEBUG_BEGIN_STMTs (TREE_SIDE_EFFECTS clear) and so end up with a STATEMENT_LIST containing DEBUG_BEGIN_STMT + e.g. the IF_STMT, while with -g0 we would end up with just the IF_STMT alone and in that case there is no STATEMENT_LIST wrapping it. Now, the STATEMENT_LIST has TREE_SIDE_EFFECTS set to match the IF_STMT, but if none of the 3 operands (condition and both branches) have TREE_SIDE_EFFECTS, genericize_if_stmt will replace the IF_STMT with COND_EXPR without TREE_SIDE_EFFECTS, but with -g only STATEMENT_LIST wrapping it will keep TREE_SIDE_EFFECTS. Then during gimplification, shortcut_cond_expr checks TREE_SIDE_EFFECTS of the operands and as it is differennt between -g and -g0, will generate different code. The following patch attempts to fix this by clearing TREE_SIDE_EFFECTS on STATEMENT_LISTs that initially have it set and contain only DEBUG_BEGIN_STMT or at most one other statement that lost TREE_SIDE_EFF= ECTS during the genericization. 2020-03-26 Jakub Jelinek PR c++/94272 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST. * g++.dg/debug/pr94272.C: New test.=