A incorrect call to `nextafter` instead of `nextafterl` made the test `sinatan-1.c` pass, when it should have failed. The cause of the failure is pointed out in PR89437. This patch addresses the cause of failure, as well the issue in the test.
gcc/ChangeLog: 2019-02-21 Giuliano Belinassi <giuliano.belina...@usp.br> PR tree-optimization/89437 * match.pd (sin (atan (x))): Change 'le' to 'lt'. (cos (atan (x))): Likewise. gcc/testsuite/gcc.dg/ChangeLog: 2019-02-21 Giuliano Belinassi <giuliano.belina...@usp.br> PR tree-optimization/89437 * sinatan-1.c: Addressed incorrect `nextafter` call.
Index: gcc/match.pd =================================================================== --- gcc/match.pd (revision 268655) +++ gcc/match.pd (working copy) @@ -4407,7 +4407,7 @@ tree t_one = build_one_cst (type); } (if (SCALAR_FLOAT_TYPE_P (type)) - (cond (le (abs @0) { t_cst; }) + (cond (lt (abs @0) { t_cst; }) (rdiv @0 (sqrts (plus (mult @0 @0) { t_one; }))) (copysigns { t_one; } @0)))))) @@ -4427,7 +4427,7 @@ tree t_zero = build_zero_cst (type); } (if (SCALAR_FLOAT_TYPE_P (type)) - (cond (le (abs @0) { t_cst; }) + (cond (lt (abs @0) { t_cst; }) (rdiv { t_one; } (sqrts (plus (mult @0 @0) { t_one; }))) (copysigns { t_zero; } @0)))))) Index: gcc/testsuite/gcc.dg/sinatan-1.c =================================================================== --- gcc/testsuite/gcc.dg/sinatan-1.c (revision 268655) +++ gcc/testsuite/gcc.dg/sinatan-1.c (working copy) @@ -62,7 +62,7 @@ /* Get first x such that 1 + x*x will overflow */ float fc = nextafterf (sqrtf (__FLT_MAX__ - 1), __FLT_MAX__); double c = nextafter (sqrt (__DBL_MAX__ - 1), __DBL_MAX__); - long double lc = nextafter (sqrtl (__LDBL_MAX__ - 1), __LDBL_MAX__); + long double lc = nextafterl (sqrtl (__LDBL_MAX__ - 1), __LDBL_MAX__); /* Force move from FPU to memory, otherwise comparison may fail due to possible more accurate registers (see 387) */ @@ -90,7 +90,7 @@ if (fy != -1.f || y != -1. || ly != -1.L) abort (); - + fy = cosatanf (-fc); y = cosatan (-c); ly = cosatanl (-lc);