Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEbrO-0004Gv-Nu for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Feb 2021 17:52:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEbrN-0000h6-LM for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Feb 2021 17:52:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEbrN-0000gy-EU for pgsql-hackers@lists.postgresql.org; Tue, 23 Feb 2021 17:52:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEbrL-0006OW-Ed for pgsql-hackers@lists.postgresql.org; Tue, 23 Feb 2021 17:52:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 11NHqSit3875616; Tue, 23 Feb 2021 12:52:28 -0500 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org Subject: Re: Some regular-expression performance hacking In-reply-to: <3874948.1614101949@sss.pgh.pa.us> References: <1340281.1613018383@sss.pgh.pa.us> <20210223173437.b3ywijygsy6q42gq@alap3.anarazel.de> <3874948.1614101949@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 23 Feb 2021 12:39:09 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3875614.1614102748.1@sss.pgh.pa.us> Date: Tue, 23 Feb 2021 12:52:28 -0500 Message-ID: <3875615.1614102748@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Hmph. There's an "assert(depth >= 0)" immediately in front of that, > so I'm not looking too kindly on the compiler thinking it's smarter > than I am. Do you have a suggestion on how to shut it up? On reflection, maybe the thing to do is convert the assert into an always-on check, "if (depth < 0) return false". The assertion is essentially saying that there's no arc leading directly from the pre state to the post state. Which there had better not be, or a lot of other stuff is going to go wrong; but I suppose there's no way to explain that to gcc. It is annoying to have to expend an always-on check for a can't-happen case, though. regards, tom lane