Skip to content
Commit 2771bc7f authored by Szabolcs Nagy's avatar Szabolcs Nagy
Browse files

math: fix spurious overflow in pow with clang

clang does not support c99 fenv_access and may move fp operations out
of conditional blocks causing unconditional fenv side-effects. Here

  if (cond)
    ix = f (x * 0x1p52);

was transformed to

  ix_ = f (x * 0x1p52);
  ix = cond ? ix_ : ix;

where x can be a huge negative value so the mul overflows. The added
barrier should prevent such transformation by significantly increasing
the cost of doing the mul unconditionally.

Found by enh from google on android arm and aarch64 targets.
Fixes github issue #16.
parent 0aed5ab8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment