From a9b1b57bd567f3a627d64bd4c915c677bb3d40b3 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 7 Aug 2015 20:13:04 +0000 Subject: [PATCH] Apply an atrocious hack to libm's pow() implementation, to work around LLVM PR 24343. This fixes the graphics/png build on i386, which otherwise failed during its tests because of floating point exceptions, leading to >5000 skipped other ports. --- lib/msun/src/e_pow.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/msun/src/e_pow.c b/lib/msun/src/e_pow.c index d54af9d6806c..66480d17790a 100644 --- a/lib/msun/src/e_pow.c +++ b/lib/msun/src/e_pow.c @@ -162,7 +162,13 @@ __ieee754_pow(double x, double y) if(lx==0) { if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ z = ax; /*x is +-0,+-inf,+-1*/ - if(hy<0) z = one/z; /* z = (1/|x|) */ + if(hy<0) { +#ifdef __i386__ + /* XXX: Work around llvm PR 24343: */ + __compiler_membar(); +#endif + z = one/z; /* z = (1/|x|) */ + } if(hx<0) { if(((ix-0x3ff00000)|yisint)==0) { z = (z-z)/(z-z); /* (-1)**non-int is NaN */