From d7f941c52e983e4c0506732f96fa2f41fbe5d9ce Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@mpcdf.mpg.de> Date: Thu, 9 Jul 2020 10:02:56 +0200 Subject: [PATCH] [bug] code throws FPE with intel 19.1.1 --- cpp/kspace.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cpp/kspace.cpp b/cpp/kspace.cpp index c2d941bd..cdb32d5d 100644 --- a/cpp/kspace.cpp +++ b/cpp/kspace.cpp @@ -148,8 +148,11 @@ kspace<be, dt>::kspace( this->nshells, MPI_DOUBLE, MPI_SUM, this->layout->comm); for (int n=0; n<this->nshells; n++){ - volatile double nnshell = std::max(double(this->nshell[n]), 1.0); - this->kshell[n] /= nnshell; + // using the `volatile` line instead of the if gets the code to work + //volatile double nnshell = std::max(double(this->nshell[n]), 1.0); + if (this->nshell[n] > 0) + //this->kshell[n] /= nnshell; + this->kshell[n] /= this->nshell[n]; } } -- GitLab