public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103491] New: nextafter does not raise "overflow" and "inexact" floating-point exceptions
@ 2021-11-30 10:39 pavel.morozkin at gmail dot com
  2021-11-30 12:16 ` [Bug middle-end/103491] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pavel.morozkin at gmail dot com @ 2021-11-30 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103491
           Summary: nextafter does not raise "overflow" and "inexact"
                    floating-point exceptions
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pavel.morozkin at gmail dot com
  Target Milestone: ---

Sample code (t0.c):
#include <fenv.h>
#include <math.h>

#pragma STDC FENV_ACCESS ON

int main(void)
{
#if __STDC_IEC_559__ == 1
    double d = 1.0;
    d = nextafter(d, INFINITY);
    return (fetestexcept(FE_INEXACT | FE_INVALID) & (FE_INEXACT | FE_INVALID))
? 0 : 1;
#else
    return 0;
#endif
}

Invocation: gcc -std=c11 -pedantic -Wall -Wextra -lm

Expected a.out exit status: 0

Actual a.out exit status: 1

C11, F.10.8.3 The nextafter functions:
> nextafter(x, y) raises the ‘‘overflow’’ and ‘‘inexact’’ floating-point exceptions for x finite and the function value infinite.

Yes, Pragma STDC * (C99 FP) is unimplemented
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785). However, __STDC_IEC_559__
is already 1.

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

end of thread, other threads:[~2021-12-01 18:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 10:39 [Bug c/103491] New: nextafter does not raise "overflow" and "inexact" floating-point exceptions pavel.morozkin at gmail dot com
2021-11-30 12:16 ` [Bug middle-end/103491] " pinskia at gcc dot gnu.org
2021-11-30 12:22 ` [Bug tree-optimization/103491] " rguenth at gcc dot gnu.org
2021-11-30 23:20 ` joseph at codesourcery dot com
2021-12-01 18:22 ` pavel.morozkin at gmail dot com

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