From: Bruno Turcksin Date: Fri, 22 Nov 2024 21:10:37 +0000 (-0500) Subject: Workaround rocm 5.7 compiler bug in debug mode when evaluating an if condition X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b145c9549806207a27aac499b1110f7e3810d5e6;p=dealii.git Workaround rocm 5.7 compiler bug in debug mode when evaluating an if condition --- diff --git a/source/base/polynomials_piecewise.cc b/source/base/polynomials_piecewise.cc index 0514f334b2..67e96a0fab 100644 --- a/source/base/polynomials_piecewise.cc +++ b/source/base/polynomials_piecewise.cc @@ -139,7 +139,16 @@ namespace Polynomials else { const double offset = step * interval; - if (x < offset || x > offset + step) + // ROCm 5.7 throw a floating point exception in debug when trying to + // evaluate (x < offset && x > offset + step). Separating the + // conditions fixes the issue. + if (x < offset) + { + for (unsigned int k = 0; k <= n_derivatives; ++k) + values[k] = 0; + return; + } + else if (x > offset + step) { for (unsigned int k = 0; k <= n_derivatives; ++k) values[k] = 0;