https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122082
--- Comment #10 from Fred J. Tydeman <tydeman at tybor dot com> ---
You are correct in that there was a problem with that test.
Here is a corrected version:
#include <assert.h>
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <float.h>
#include <fenv.h>
#include <complex.h>
#include <math.h> /* glibc 2.41-11 */
#pragma STDC FENV_ACCESS ON
#pragma STDC FP_CONTRACT OFF
#pragma STDC FENV_ROUND FE_TONEAREST
#pragma STDC FENV_DEC_ROUND FE_DEC_TONEAREST
#pragma STDC CX_LIMITED_RANGE OFF
int main(void){
if(1){
float complex fc26;
int flags;
errno = 0;
feclearexcept(FE_ALL_EXCEPT);
fc26 = CMPLXF(FLT_MAX,1.1F) * CMPLXF(FLT_MAX,-1.1F); /* w * conj(w) */
flags = fetestexcept(FE_ALL_EXCEPT);
(void)printf("%Lg=cimagf(fc26)\n", (long double)cimagf(fc26) );
(void)fflush(NULL);
assert( 0 == errno );
assert( FE_OVERFLOW & flags );
assert( FE_INEXACT & flags );
assert( INFINITY == crealf(fc26) );
assert( !isnan(cimagf(fc26)) || (0.f == cimagf(fc26)) || (!(FE_INVALID &
flags)) ); /* fails here */
}
return 0;
}