Skip to content

Commit a1fb514

Browse files
authored
[libc] Prevent constant propagation for atanf(+-Inf) in gcc. (#85733)
gcc bot failures with `atanf(+-Inf)`: https://lab.llvm.org/buildbot/#/builders/250/builds/20331/steps/8/logs/stdio
1 parent d1e2305 commit a1fb514

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libc/src/math/generic/atanf.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ LLVM_LIBC_FUNCTION(float, atanf, (float x)) {
3737
double const_term = 0.0;
3838
if (LIBC_UNLIKELY(x_abs >= 0x4180'0000)) {
3939
// atan(+-Inf) = +-pi/2.
40-
if (x_bits.is_inf())
41-
return static_cast<float>(SIGNED_PI_OVER_2[sign.is_neg()]);
40+
if (x_bits.is_inf()) {
41+
volatile double sign_pi_over_2 = SIGNED_PI_OVER_2[sign.is_neg()];
42+
return static_cast<float>(sign_pi_over_2);
43+
}
4244
if (x_bits.is_nan())
4345
return x;
4446
// x >= 16

0 commit comments

Comments
 (0)