From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 227D03858C52 for ; Mon, 1 Aug 2022 08:21:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 227D03858C52 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id D89B24D668; Mon, 1 Aug 2022 08:21:20 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id BD1AA2C141; Mon, 1 Aug 2022 08:21:20 +0000 (UTC) Date: Mon, 1 Aug 2022 08:21:20 +0000 (UTC) From: Richard Biener To: Iain Sandoe cc: GCC Patches Subject: Re: [PATCH] tree-optimization/105679 - disable backward threading of unlikely entry In-Reply-To: Message-ID: References: <20220729085417.4B50F13A1B@imap2.suse-dmz.suse.de> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2022 08:21:23 -0000 On Sun, 31 Jul 2022, Iain Sandoe wrote: > Hi Richi, > > > On 29 Jul 2022, at 09:54, Richard Biener via Gcc-patches wrote: > > > > The following makes the backward threader reject threads whose entry > > edge is probably never executed according to the profile. That in > > particular, for the testcase, avoids threading the irq == 1 check > > on the path where irq > 31, thereby avoiding spurious -Warray-bounds > > diagnostics > > This breaks bootstrap on i686-darwin{9,17} with what looks like a valid warning (werrors on stage2) > > cc1plus … -O2 -Wall … is enough to. > > I can repeat it on a cross from x86_64-darwin19, so I can probably reduce the .ii (it’s like 2M5 raw) and file a PR if you like - depends if the solution might be obvious to you … Can you open a bugreport and attach full preprocessed source at start? Note at the start of the function we have if (m_path.length () <= 1) return false; so edge entry = find_edge (m_path[m_path.length () - 1], m_path[m_path.length () - 2]); is known to not access m_path out-of-bounds ... Thanks, Richard. > > thanks > Iain > > -------- > > In file included from /src-local/gcc-master/gcc/hash-table.h:248, > from /src-local/gcc-master/gcc/coretypes.h:486, > from /src-local/gcc-master/gcc/tree-ssa-threadbackward.cc:22: > In member function ‘T& vec::operator[](unsigned int) [with T = basic_block_def*; A = va_heap]’, > inlined from ‘const T& vec::operator[](unsigned int) const [with T = basic_block_def*]’ at /src-local/gcc-master/gcc/vec.h:1486:20, > inlined from ‘bool back_threader_profitability::profitable_path_p(const vec&, tree, edge, bool*)’ at /src-local/gcc-master/gcc/tree-ssa-threadbackward.cc:781:37: > /src-local/gcc-master/gcc/vec.h:890:19: warning: array subscript 4294967294 is above array bounds of ‘basic_block_def* [1]’ [-Warray-bounds] > 890 | return m_vecdata[ix]; > | ~~~~~~~~~^ > /src-local/gcc-master/gcc/vec.h: In member function ‘bool back_threader_profitability::profitable_path_p(const vec&, tree, edge, bool*)’: > /src-local/gcc-master/gcc/vec.h:635:5: note: while referencing ‘vec::m_vecdata’ > 635 | T m_vecdata[1]; > | ^~~~~~~~~ > > ===== -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)