[PATCH] D156506: [clang][Interp] Check floating results for NaNs
Joshua Cranmer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 2 14:26:51 PDT 2023
jcranmer-intel added a comment.
You definitely don't want these rules to apply to all qNaNs. It's when an input operand is an sNaN for many operations. Note that the result of an operation with an sNaN as input (and FP result type) is a qNaN output, and the only times that you get an sNaN output are the times when you never signal (I think), so checking the result type is incorrect.
================
Comment at: clang/lib/AST/Interp/Interp.cpp:534-539
if ((Status & APFloat::opStatus::opInvalidOp) &&
FPO.getExceptionMode() != LangOptions::FPE_Ignore) {
// There is no usefully definable result.
S.FFDiag(E);
return false;
}
----------------
A further note is that sNaNs signal `FE_INVALID` when used, so sNaN should generally fall into this if statement in particular.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156506/new/
https://reviews.llvm.org/D156506
More information about the cfe-commits
mailing list