From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A9163858420; Fri, 12 Nov 2021 20:55:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A9163858420 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0 Date: Fri, 12 Nov 2021 20:55:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: hubicka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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: Fri, 12 Nov 2021 20:55:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103209 --- Comment #3 from Jan Hubicka --- This is bug I introduced to tree-ssa-structalias where I reversed order of flags which deterine global memory read and writes. So pure functions are handled as functions writting global memory but not reading it. I am very surprised it took so long to show as wrong code. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 153ddf57a61..34fd47fdf47 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4996,7 +4996,7 @@ find_func_aliases_for_call (struct function *fn, gcall *t) reachable from their arguments, but they are not an escape point for reachable memory of their arguments. */ else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE)) - handle_rhs_call (t, &rhsc, implicit_pure_eaf_flags, true, false); + handle_rhs_call (t, &rhsc, implicit_pure_eaf_flags, false, true); /* If the call is to a replaceable operator delete and results from a delete expression as opposed to a direct call to such operator, then the effects for PTA (in particular=