scanon requested changes to this revision.
scanon added inline comments.
This revision now requires changes to proceed.


================
Comment at: include/math.h:1586
+    return _Lim::min();
+  }
+  return static_cast<_IntT>(__trunc_r);
----------------
EricWF wrote:
> scanon wrote:
> > If I'm reading right, NaNs will fall through the above two comparisons and 
> > invoke UB on the static_cast below. I suspect that's not the desired 
> > behavior. What is the intended result for NaN?
> I didn't want to treat `NaN` as a valid input, so I want to allow UBSAN to 
> catch it rather than to provide a valid output.
Please document this clearly; otherwise someone will assume that this is a 
UB-free conversion and use it for that purpose.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66836/new/

https://reviews.llvm.org/D66836



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to