From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1075) id E2B023858030; Fri, 12 Nov 2021 15:35:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2B023858030 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jan Hubicka To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5201] Fix ICE in tree-ssa-structalias.c X-Act-Checkin: gcc X-Git-Author: Jan Hubicka X-Git-Refname: refs/heads/master X-Git-Oldrev: f49c7a4fb23d82c89c97acec88770b300c903d9a X-Git-Newrev: 4526ec20f17a6182f754da9460d9d944dd123cc0 Message-Id: <20211112153511.E2B023858030@sourceware.org> Date: Fri, 12 Nov 2021 15:35:11 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2021 15:35:12 -0000 https://gcc.gnu.org/g:4526ec20f17a6182f754da9460d9d944dd123cc0 commit r12-5201-g4526ec20f17a6182f754da9460d9d944dd123cc0 Author: Jan Hubicka Date: Fri Nov 12 16:34:03 2021 +0100 Fix ICE in tree-ssa-structalias.c PR tree-optimization/103175 * ipa-modref.c (modref_lattice::merge): Add sanity check. (callee_to_caller_flags): Make flags adjustment sane. (modref_eaf_analysis::analyze_ssa_name): Likewise. Diff: --- gcc/ipa-modref.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 44b3427a202..e999c2c5d1e 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1681,6 +1681,13 @@ modref_lattice::merge (int f) { if (f & EAF_UNUSED) return false; + /* Check that flags seems sane: if function does not read the parameter + it can not access it indirectly. */ + gcc_checking_assert (!(f & EAF_NO_DIRECT_READ) + || ((f & EAF_NO_INDIRECT_READ) + && (f & EAF_NO_INDIRECT_CLOBBER) + && (f & EAF_NO_INDIRECT_ESCAPE) + && (f & EAF_NOT_RETURNED_INDIRECTLY))); if ((flags & f) != flags) { flags &= f; @@ -1889,9 +1896,11 @@ callee_to_caller_flags (int call_flags, bool ignore_stores, if (!(call_flags & EAF_NO_DIRECT_ESCAPE)) lattice.merge (~(EAF_NOT_RETURNED_DIRECTLY | EAF_NOT_RETURNED_INDIRECTLY + | EAF_NO_DIRECT_READ | EAF_UNUSED)); if (!(call_flags & EAF_NO_INDIRECT_ESCAPE)) lattice.merge (~(EAF_NOT_RETURNED_INDIRECTLY + | EAF_NO_DIRECT_READ | EAF_UNUSED)); } else @@ -2033,11 +2042,11 @@ modref_eaf_analysis::analyze_ssa_name (tree name) if (!(call_flags & (EAF_NOT_RETURNED_DIRECTLY | EAF_UNUSED))) m_lattice[index].merge (~(EAF_NO_DIRECT_ESCAPE - | EAF_NO_INDIRECT_ESCAPE | EAF_UNUSED)); if (!(call_flags & (EAF_NOT_RETURNED_INDIRECTLY | EAF_UNUSED))) m_lattice[index].merge (~(EAF_NO_INDIRECT_ESCAPE + | EAF_NO_DIRECT_READ | EAF_UNUSED)); call_flags = callee_to_caller_flags (call_flags, false,