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.