Hi Marcin,

On 7 Apr 2016, at 20:13, Marcin Wojdyr <[email protected]> wrote:

the original problem that Richard located at:

     if (f_sq > 0) f = std::sqrt(f_sq);
     else f = 0;

is interesting. It seems that sqrt is hoisted in some situations which
causes problems with -ffast-math.
I wouldn't think that compiler may speculatively run sqrt, but it
can[1], it must be sometimes faster.
[1] http://reviews.llvm.org/D2428

I managed to fix the problem by copying f_sq into a volatile temporary f_sq_ of which I then take the square root. So I tend to agree with your guess.

PS. this is rather heavy-handed:

r24214 | rjgildea | 2016-04-07 16:42:49 +0100 (czw, 07 kwi 2016) | 1 line

A couple of dials tests crash after XCode 7.3 update with -O2 or -O3
flags set: setting -O1 optimization appears 

We discussed with Richard whether to lower optimisation only for the file failing to correctly compile or to do it globally. I concluded that the former is too much work considering the next update of Xcode could solve those and/or introduce new issues elsewhere! 

Is there a release of Phenix or CCP4 looming on the horizon? That would be a good reason to go the extra mile and only disable optimisation where necessary.

Best wishes,

Luc