bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>, Pip Cet <pipcet@gmail.com>
Cc: 36370@debbugs.gnu.org, bug-gnulib@gnu.org
Subject: Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers
Date: Sat, 29 Jun 2019 10:11:40 -0700	[thread overview]
Message-ID: <99bacb9f-1192-1315-85d7-5ab4924dfef8@cs.ucla.edu> (raw)
In-Reply-To: <2515002.Q0mBYvUW8C@omega>

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

Bruno Haible wrote:

> +   If you want the use of this macro to improve, not deteriorate,
> +   performance, R should not contain function calls except to functions
> +   that are declared 'inline __attribute__((__always_inline__))'.  */

A reader of that might incorrectly conclude that using such functions will 
always improve performance, compared to using functions not declared that way. 
And I'm leery of putting such GCC-specific info into the documentation of a 
generic macro.

Also, given Pip Cet's misunderstanding it'd be helpful to add a word or two 
about the intent of 'assume (R)'.

How about the attached patch?

 > -   evaluated.  Behavior is undefined if R is false.  */
 > +   evaluated.  The behavior is undefined if R is false.

This is a nit, but to my ears the shorter version is better, and has a 
more-accurate connotation as "the behavior" connotes "the behavior of 'assume 
(R)'", whereas behavior is also undefined for code before or after a call to an 
incorrect 'assume (R)'.

[-- Attachment #2: verify.diff --]
[-- Type: text/x-patch, Size: 800 bytes --]

diff --git a/lib/verify.h b/lib/verify.h
index f8e4eff02..168a7afdb 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -259,9 +259,11 @@ template <int w>
 # define __has_builtin(x) 0
 #endif
 
-/* Assume that R always holds.  This lets the compiler optimize
-   accordingly.  R should not have side-effects; it may or may not be
-   evaluated.  Behavior is undefined if R is false.  */
+/* Assume that R always holds.  Behavior is undefined if R is false.
+   R should lack side effects, as it may be evaluated only partially.
+   Although 'assume (R)' is typically intended to help performance,
+   performance may degrade if R uses hard-to-optimize features
+   such as calls to non-inlined functions.  */
 
 #if (__has_builtin (__builtin_unreachable) \
      || 4 < __GNUC__ + (5 <= __GNUC_MINOR__))

  reply	other threads:[~2019-06-29 17:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOqdjBcM09RbDv19xNF7HxmykU2oAJ4Vsm45Y65aYXZbOO9u3g@mail.gmail.com>
     [not found] ` <e7d67132-4c2e-5c3a-74ae-78c8d67b8132@cs.ucla.edu>
     [not found]   ` <CAOqdjBct1qJ43dAL5642B52ZXH9M1x_qYOZX3GzJi6YvckoS7Q@mail.gmail.com>
     [not found]     ` <de8a8fa5-176c-f22a-fa56-c5d54fd42352@cs.ucla.edu>
     [not found]       ` <CAOqdjBd7FXkSd=brysRa8bc+o5uHTBshQ2XxQ2ZSyt=naJgp0g@mail.gmail.com>
     [not found]         ` <7ef599ae-0a1d-e86f-2bed-a1503455833f@cs.ucla.edu>
     [not found]           ` <CAOqdjBcyT17XDSAEm2NVtFbJLyEc4m9jj_9sX-nyOUKca2aUwA@mail.gmail.com>
2019-06-27 21:13             ` bug#36370: 27.0.50; XFIXNAT called on negative numbers Paul Eggert
2019-06-27 21:37               ` Pip Cet
2019-06-27 23:45               ` Bruno Haible
2019-06-28  0:04                 ` Paul Eggert
2019-06-28 11:06                 ` Pip Cet
2019-06-28 12:14                   ` Bruno Haible
2019-06-28 12:29                     ` Bruno Haible
2019-06-28 13:51                     ` Pip Cet
2019-06-28 17:46                       ` Paul Eggert
2019-06-28 19:15                         ` Pip Cet
2019-06-28 19:56                           ` Bruno Haible
2019-06-28 21:08                             ` Pip Cet
2019-06-29  5:41                           ` Paul Eggert
2019-06-29  6:48                             ` Pip Cet
2019-06-29 17:31                               ` Paul Eggert
2019-06-30  9:21                                 ` Pip Cet
2019-06-28 19:11                       ` Bruno Haible
2019-06-28 21:07                         ` Pip Cet
2019-06-28 23:30                           ` Bruno Haible
2019-06-29  5:40                             ` Paul Eggert
2019-06-29  5:44                             ` Pip Cet
2019-06-29 10:31                               ` Bruno Haible
2019-06-29 17:11                                 ` Paul Eggert [this message]
2019-06-29 17:48                                   ` Bruno Haible
2019-06-30 15:30                                 ` Pip Cet
2019-06-30 15:45                                   ` Bruno Haible
2019-07-02 23:39                                     ` Paul Eggert
2019-07-01  1:46                                   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99bacb9f-1192-1315-85d7-5ab4924dfef8@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=36370@debbugs.gnu.org \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=pipcet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).