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 404223858009 for ; Tue, 24 Nov 2020 02:58:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 404223858009 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@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 0AO2vhbk014708; Mon, 23 Nov 2020 20:57:43 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 0AO2vhbs014707; Mon, 23 Nov 2020 20:57:43 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 23 Nov 2020 20:57:43 -0600 From: Segher Boessenkool To: Richard Biener Cc: "J.W. Jagersma" , GCC Patches Subject: Re: [PATCH v3 1/2] generate EH info for volatile asm statements (PR93981) Message-ID: <20201124025743.GU2672@gate.crashing.org> References: <20200312003851.2366-1-jwjagersma@gmail.com> <20200312003851.2366-2-jwjagersma@gmail.com> 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=-6.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 24 Nov 2020 02:58:46 -0000 On Fri, Nov 13, 2020 at 09:41:28AM +0100, Richard Biener via Gcc-patches wrote: > On Thu, Mar 12, 2020 at 1:41 AM J.W. Jagersma via Gcc-patches > wrote: > > The following patch extends the generation of exception handling > > information, so that it is possible to catch exceptions thrown from > > volatile asm statements, when -fnon-call-exceptions is enabled. Parts > > of the gcc code already suggested this should be possible, but it was > > never fully implemented. > As you say volatile asms are already considered throwing in some pieces of > code so this is a step towards fulfilling that promise. But that is just wrong. Volatile is an orthogonal concept. There is nothing wrong with having a non-volatile throwing asm, either, and it can optimise better. Can you just add some markup for throwing asm? LLVM implements "asm goto" with outputs as a throwing insn, instead of as a jump insn (as it should be, as it is documented!) I suggested doing an "asm break" (or whatever name, this is just a vaguely related already existing keyword) for this, instead. This has exactly the semantics you want: all outputs are written on the normal path, and they are either or not written when it throws. The difference with your situation is in that case you specify all labels the code could jump to, and in your case you don't. Maybe just one less colon could make the distinction? (asm goto has four colons, other asm has at most three). Segher