On 2025-12-21 01:53, Jₑₙₛ Gustedt wrote:
from what I recall, the
proposed changes seemed to complicated and there were too much
discussions for people to feel confident to apply these.

Thanks for letting us know. I installed the attached patch to Gnulib to reflect that the proposals were not accepted.


In the mean time, I personally am not convinced anymore that we should
be adding termination to the side effects are prohibited. In general,
it is not clear for all functions that are "pure" (in the CS sense of
the term) that they shouldn't have error conditions that lead to
program or thread termination.

OK, but doesn't this mean compilers can't optimize in the way that [[reproducible]] and [[unsequenced]] were designed to allow? For example, as I understand it, the intent was that if f is declared with '[[reproducible]] void f (int *);', then a compiler can generate code that omits the second call to f in the following example:

  int
  main ()
  {
    int flag = 0;
    f (&flag);
    f (&flag);
    return flag;
  }

However, suppose f is defined this way:

  void
  f (int *b)
  {
    if (*b) // error condition ...
      exit (2); // ... that leads to termination
    *b = 1;
  }

If [[reproducible]] allows this sort of thing, then it's not valid to do the optimization that I mentioned, because it will cause the program to exit with status 1 rather than status 2.
From c855ab03a81a5fc8cecdcacd391728bd1135bd9b Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Wed, 24 Dec 2025 00:51:26 -0800
Subject: [PATCH] Omit "ATTENTION!" comments re reproducible/unsequenced

These comments are out of date as the efforts did not pan out.
---
 lib/attribute.h     | 8 ++------
 m4/gnulib-common.m4 | 8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/lib/attribute.h b/lib/attribute.h
index eded1543a5..e71c9f50ae 100644
--- a/lib/attribute.h
+++ b/lib/attribute.h
@@ -271,9 +271,7 @@
    the function cannot return a pointer to storage whose contents
    change later.)
    See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
-   <https://stackoverflow.com/questions/76847905/>.
-   ATTENTION! Efforts are underway to change the meaning of this attribute.
-   See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3494.htm>.  */
+   <https://stackoverflow.com/questions/76847905/>.  */
 /* Applies to: functions, pointer to functions, function type.  */
 #define UNSEQUENCED _GL_ATTRIBUTE_UNSEQUENCED
 
@@ -303,9 +301,7 @@
    and can change state addressed by its pointer arguments, but the
    function cannot return a pointer to storage whose contents change later.)
    See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
-   <https://stackoverflow.com/questions/76847905/>.
-   ATTENTION! Efforts are underway to change the meaning of this attribute.
-   See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3494.htm>.  */
+   <https://stackoverflow.com/questions/76847905/>.  */
 /* Applies to: functions, pointer to functions, function type.  */
 #define REPRODUCIBLE _GL_ATTRIBUTE_REPRODUCIBLE
 
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index efd9f23126..e9de35f769 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -782,9 +782,7 @@ AC_DEFUN([gl_COMMON_BODY], [
    and can change state addressed by its pointer arguments, but the
    function cannot return a pointer to storage whose contents change later.)
    See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
-   <https://stackoverflow.com/questions/76847905/>.
-   ATTENTION! Efforts are underway to change the meaning of this attribute.
-   See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3494.htm>.  */
+   <https://stackoverflow.com/questions/76847905/>.  */
 /* Applies to: functions, pointer to functions, function types.  */
 #ifndef _GL_ATTRIBUTE_REPRODUCIBLE
 /* This may be revisited when gcc and clang support [[reproducible]] or possibly
@@ -839,9 +837,7 @@ AC_DEFUN([gl_COMMON_BODY], [
    the function cannot return a pointer to storage whose contents
    change later.)
    See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
-   <https://stackoverflow.com/questions/76847905/>.
-   ATTENTION! Efforts are underway to change the meaning of this attribute.
-   See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3494.htm>.  */
+   <https://stackoverflow.com/questions/76847905/>.  */
 /* Applies to: functions, pointer to functions, function types.  */
 #ifndef _GL_ATTRIBUTE_UNSEQUENCED
 /* This may be revisited when gcc and clang support [[unsequenced]] or possibly
-- 
2.51.0

Reply via email to