public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/31600] New: math: x86 ceill traps when FE_INEXACT is enabled
@ 2024-04-03 18:56 adhemerval.zanella at linaro dot org
  2024-04-04 17:39 ` [Bug math/31600] " adhemerval.zanella at linaro dot org
  0 siblings, 1 reply; 2+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-04-03 18:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31600

            Bug ID: 31600
           Summary: math: x86 ceill traps when FE_INEXACT is enabled
           Product: glibc
           Version: 2.39
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: adhemerval.zanella at linaro dot org
  Target Milestone: ---

The implementations of ceil functions using x87 floating point (i386 and x86_64
long double only) traps when FE_INEXACT is enabled. Although this is a GNU
extension outside the scope of the C standard, other architectures that also
support traps do not show this behavior (aarch64, powerpc64).

The following test shows that issue:

$ cat test-ceil.c
#include <assert.h>
#include <math.h>
#include <fenv.h>

int main (int argc, char *argv[])
{
  feenableexcept (FE_INEXACT);
  volatile long double a = 1.5;
  volatile long double b  __attribute__ ((unused));
  b = ceill (a);
  assert (fegetexcept () == FE_INEXACT);

  return 0;
}
$ gcc -Wall -D_GNU_SOURCE test-ceil.c -lm && ./a.out
Floating point exception (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-04 17:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 18:56 [Bug math/31600] New: math: x86 ceill traps when FE_INEXACT is enabled adhemerval.zanella at linaro dot org
2024-04-04 17:39 ` [Bug math/31600] " adhemerval.zanella at linaro dot org

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).