https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116130

            Bug ID: 116130
           Summary: Implement C23 N2956 paper - [[unsequenced]] and
                    [[reproducible]] function type arguments
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

The paper claims that the two are supersets of [[gnu::const]] and
[[gnu::pure]], but I think that is not the case.
See e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109914#c5 on the lack of
assertion of finitness.
I guess for function types without pointer (for C++ reference too) arguments we
could just imply ECF_CONST|ECF_LOOPING_CONST_OR_PURE or
ECF_PURE|ECF_LOOPING_CONST_OR_PURE
(say in flags_from_decl_or_type?).
For the rest it becomes more difficult.
Richi suggested using "fn spec" attribute for that, would that be
".c" for the first 2 chars, ". " for non-pointer arguments and "w " for the
pointer ones?  Though, I wonder if [[unsequenced]] or [[reproducible]]
functions can't say escape arguments in something the argument points to.
[[unsequenced]] int foo (int *p, int **q) {
  p[0] = q[0][0];
  q[1] = p;
  return 42;
}
or similar.

Reply via email to