On Tue, Feb 18, 2025 at 1:21 AM Sam James <s...@gentoo.org> wrote:
>
> Peter Damianov <peter0...@disroot.org> writes:
>
> > POSIX says that sin and cos should set errno to EDOM when infinity is 
> > passed to
> > them. Make sure this is accounted for in builtins.def, and add tests.
> >
> > gcc/
> >       PR middle-end/80042
> >       * builtins.def: (sin|cos)(f|l) can set errno.
> > gcc/testsuite/
> >       * gcc.dg/pr80042.c: New testcase.
> > ---
> >  gcc/builtins.def               | 20 +++++-----
> >  gcc/testsuite/gcc.dg/pr80042.c | 71 ++++++++++++++++++++++++++++++++++
> >  2 files changed, 82 insertions(+), 9 deletions(-)
> >  create mode 100644 gcc/testsuite/gcc.dg/pr80042.c
> >
> > [...]
> > diff --git a/gcc/testsuite/gcc.dg/pr80042.c b/gcc/testsuite/gcc.dg/pr80042.c
> > new file mode 100644
> > index 00000000000..cc578ae67e2
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.dg/pr80042.c
> > @@ -0,0 +1,71 @@
> > +/* dg-do run */
> > +/* dg-options "-O2 -lm" */
>
> These two lines are missing {}. Please double check the logs from your
> testsuite run to make sure newly added/changed tests are executed (and
> in the way you expect).

This test will also FAIL on *BSD IIRC as that doesn't set errno for any math
functions.

I'll note GCC models sincos as cexpi which does not set errno, and will
eventually expand that to sincos or cexp.  It does that without any
restriction on -fno-math-errno.

I'll also note the C standard does not document any domain error on +-
Inf arguments.
Instead it documents a range error for sin(x) and nonzero x too close to zero.

Richard.

>
> > [...]

Reply via email to