[cfp-interest 3438] Re: [[reproducible]] EXAMPLE 3 in 6.7.13.8
JeanHeyd Meneide
phdofthehouse at gmail.com
Mon Apr 14 12:12:17 PDT 2025
On Mon, Apr 14, 2025 Jim Thomas <jaswthomas at sbcglobal.net> wrote:
> EXAMPLE 3 in 6.7.13.8.3 (in N3467) seems wrong. I understand that if a
> function is declared with the [[reproducible]] attribute then the
> compiler can elide repeated calls with the same arguments. But two such
> calls to the distance function in the example could not be elided if
> status flags are cleared after the first call and tested after the second.
> The function can raise “overflow”, “underflow”, and “inexact”
> floating-point exceptions.
>
Both asking and trying to find a solution, here. Does this mean in
addition to the FP_CONTRACT pragma, it needs to also turn off FENV_ACCESS
to prevent having access to floating point status flags? Does turning it
off inside of a function mean a function cannot change those flags anymore,
or does it just mean that the function itself won't access those flags? The
former, I think, would solve this problem, but the latter doesn't help for
the example I don't believe. (And, fi that is the case, do we then need to
look into explicitly asserting that the floating point flags / exceptions
are not active?)
If we did want to make such a function reproducible, what would you
change to make it that way?
Sincerely,
JeanHeyd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20250414/113061f6/attachment.htm>
More information about the cfp-interest
mailing list