https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121807
Bug ID: 121807
Summary: compare (<, <=, >=, >) with NAN is not raising
"invalid"
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: tydeman at tybor dot com
Target Milestone: ---
This code fails:
#include <assert.h>
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <float.h>
#include <fenv.h>
#include <math.h>
int main(void){
if(1){
int i;
int flags;
feclearexcept( FE_ALL_EXCEPT );
if( !(NAN > 0.f) ){ /* raise invalid */
i = 1;
}else{
i = 0;
}
flags = fetestexcept( FE_ALL_EXCEPT );
assert( 0 != flags ); /* fails here */
}
return 0;
}
C23: 7.12.17 Comparison macros
The descriptions of the various macros mention that the relational operators
raise invalid