From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 3EE373858C83 for ; Tue, 8 Mar 2022 15:50:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3EE373858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 228FnFMg012292; Tue, 8 Mar 2022 09:49:15 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 228FnFDH012288; Tue, 8 Mar 2022 09:49:15 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 8 Mar 2022 09:49:15 -0600 From: Segher Boessenkool To: Marek Polacek Cc: Jakub Jelinek , GCC Patches Subject: Re: [PATCH] rtl: ICE with thread_local and inline asm [PR104777] Message-ID: <20220308154915.GP614@gate.crashing.org> References: <20220308000317.93455-1-polacek@redhat.com> <20220308011909.GN614@gate.crashing.org> <20220308151456.GO614@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: Tue, 08 Mar 2022 15:50:17 -0000 On Tue, Mar 08, 2022 at 10:25:45AM -0500, Marek Polacek wrote: > On Tue, Mar 08, 2022 at 09:14:56AM -0600, Segher Boessenkool wrote: > > On Tue, Mar 08, 2022 at 10:08:25AM -0500, Marek Polacek wrote: > > > ...I don't see that. In fact copy_rtx does the same thing as > > > copy_insn: > > > > > > case 'V': > > > if (XVEC (orig, i) != NULL) > > > { > > > XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i)); > > > > > > which will copy a zero-length vector too, right? > > > > It doesn't. It copies NULL as NULL. That is what that "if" is for. > > But XVEC (orig, i) is not null, it just has XVECLEN 0. So where did *that* come from? This isn't correct RTL. > > You can do similar in copy_insn_1? > > You mean copy_rtx? It already has the same XVEC (orig, i) != NULL check. No, I mean do similar in copy_insn_1 as what copy_rtx already (correctly) does. > But like I said above, even if we didn't copy these XVECLEN 0 rtvecs, > the crash would not go away. An rtvec should never have length 0. Look at gen_rtvec for another example. You can get rid of the crash, sure. But it is a much better plan to try and get rid of the actual problem! (And then add some more checking to make sure this doesn't happen in the future.) Segher