For the code: #include <cmath> double t1(double n) { return std::pow(n, -0.0); } clang (trunk, 8.0) crashes with the follworing message: https://pastebin.com/w7nVhwtu clang 7.0 and below works fine. Godbolt playground: https://godbolt.org/z/aRbTH0
FWIW, this is triggered in particular by -ffast-math: $ cat pr43233-min.cpp // clang -cc1 -triple x86_64-- -S -ffast-math -O1 pr43233-min.cpp extern "C" double pow(double, double); double f(double d) { return pow(d, -0.0); } $ clang -cc1 -triple x86_64-- -S -ffast-math -O1 pr43233-min.cpp Assertion failed: (Exp != 0 && "Incorrect exponent 0 not handled"), function getPow, file llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp, line 1170. Abort trap It looks like this regressed with https://reviews.llvm.org/rL339578 ("[SLC] Expand simplification of pow() for vector types") by evandro.
(In reply to Dimitry Andric from comment #1) > It looks like this regressed with https://reviews.llvm.org/rL339578 ("[SLC] > Expand simplification of pow() for vector types") by evandro. Yes - this was an unintentional diff: ExpoC->getValueAPF().isZero() handles either -0.0/+0.0, but m_SpecificFP(0.0) does not. I can fix this.
Thank you.
Trunk fix committed: https://reviews.llvm.org/rL371221 And I didn't know it, but there was an identical patch in progress in here: https://reviews.llvm.org/D67248 We probably want to get this fixed in the branches too, so not marking as resolved yet.
Merged to release_90 in r371381.
(In reply to Hans Wennborg from comment #5) > Merged to release_90 in r371381. Thanks, Hans!