From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Haible Newsgroups: gmane.emacs.bugs,gmane.comp.lib.gnulib.bugs Subject: bug#36370: 27.0.50; XFIXNAT called on negative numbers Date: Fri, 28 Jun 2019 21:56:05 +0200 Message-ID: <2490928.QNlPtjyuh0@omega> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="44643"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: KMail/5.1.3 (Linux/4.4.0-151-generic; KDE/5.18.0; x86_64; ; ) Cc: 36370@debbugs.gnu.org, Paul Eggert , bug-gnulib@gnu.org To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 28 21:57:33 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hgwzx-000BPS-7t for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Jun 2019 21:57:31 +0200 Original-Received: from localhost ([::1]:36038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgwzw-0000lp-82 for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Jun 2019 15:57:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37034) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgwzZ-0000ig-6z for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2019 15:57:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgwzX-0000W9-4Q for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2019 15:57:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgwzX-0000Vp-0c for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2019 15:57:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hgwzW-0008Mb-To for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2019 15:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bruno Haible Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Jun 2019 19:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36370 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36370-submit@debbugs.gnu.org id=B36370.156175177232058 (code B ref 36370); Fri, 28 Jun 2019 19:57:02 +0000 Original-Received: (at 36370) by debbugs.gnu.org; 28 Jun 2019 19:56:12 +0000 Original-Received: from localhost ([127.0.0.1]:43066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgwyi-0008Kz-9W for submit@debbugs.gnu.org; Fri, 28 Jun 2019 15:56:12 -0400 Original-Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.51]:20615) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgwyf-0008Ko-Aj for 36370@debbugs.gnu.org; Fri, 28 Jun 2019 15:56:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1561751767; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=q5B96l2kKcE0Gw8DRtavVqjHjH1eCunMAcpqoYqWY8U=; b=hG2YcdNr247BXxZSquAnCpTeYEknMSqGe6VGwoHAzUdjb7h0/IYwlnOUp7TK7Sqy1t ptSj/LfH8MjwOgsQDy9MKkXJUjktWr044irk+dRRqKdew5X76f7IJSzdTWMfUi7kZPVA hwn0oXyAmruPPIvZt38kVCpv4RG18ibDCif/YPaQlVMjO01d2kd3VrjLLV9Pvfxj5ew2 8kxdnjW6gUxtY+23Cpp5yADV0vm2dd07P7KaXiZyPDR/Pr+d5FZX697HWEK0lUeksJpl h6mKNh/vLreOGfHCVJeSuhOQbsxT/5TorHefHqM/zB3QJOtoxSff9Zzc09hMFFmxracf Utng== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGaf0zJZW" X-RZG-CLASS-ID: mo00 Original-Received: from bruno.haible.de by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id v018bcv5SJu5k0z (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Fri, 28 Jun 2019 21:56:05 +0200 (CEST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161769 gmane.comp.lib.gnulib.bugs:40584 Archived-At: On Freitag, 28. Juni 2019 19:15:06 CEST Pip Cet wrote: > On Fri, Jun 28, 2019 at 5:46 PM Paul Eggert wrote: > > Pip Cet wrote: > > > It's way too easy > > > to do something like > > > > > > eassume(ptr->field >= 0 && f(ptr)); > > > > > > when what you mean is > > > > > > eassume(ptr->field >= 0); > > > eassume(f(ptr)); > > > > These mean the same thing. > > I'm really convinced they don't. Can you humor me and explain why > they're equivalent? > > I'm considering this test case: > ==== > int global; > > extern int f(void); > > #define eassume0(cond) ((cond) ? (void) 0 : __builtin_unreachable ()) > #ifdef ASSUME_GNULIB > #define eassume eassume0 > #else > #define eassume(cond) (__builtin_constant_p (!(cond) == !(cond)) ? > eassume0(cond) : (void) 0) > #endif > > int main(void) > { > #ifdef TWO_ASSUMES > eassume (global == 0); > eassume (f ()); > #else > eassume (global == 0 && f ()); > #endif > > global++; > } > ==== > with this external function: > ==== > extern int global; > > int f(void) > { > return ++global; > } > ==== > > I believe, and that is what my patch is based on, that the compiler > should be free to "use" the first eassume and ignore the second one, > resulting in this machine code: > > movl $1, global(%rip) > xorl %eax, %eax > ret For reference: This test case produces: Options Result none increment -DASSUME_GNULIB increment -DTWO_ASSUMES single-store -DASSUME_GNULIB -DTWO_ASSUMES increment Bruno