================ @@ -816,6 +816,11 @@ class FPOptions { setAllowFPReassociate(LO.AllowFPReassoc); setNoHonorNaNs(LO.NoHonorNaNs); setNoHonorInfs(LO.NoHonorInfs); + // Ensure that if FiniteMathOnly is enabled, NoHonorNaNs and NoHonorInfs are + // also enabled. This is because FiniteMathOnly mode assumes no NaNs or Infs + // are present in computations. + if (!LO.NoHonorInfs || !LO.NoHonorInfs) + assert(!LO.FiniteMathOnly && "FiniteMathOnly implies NoHonorInfs"); ---------------- AaronBallman wrote:
That sounds like a logic bug to me -- if infs and nans are disabled, then it's definitely finite math only mode. If infs *OR* nans are disabled... I think it's also finite math only mode. Ideally, I think we should get rid of the internal notion of `FiniteMathOnly` and replace it with the honor infs/nans flags explicitly so we don't get into these sort of situations to begin with. We'd still have to answer how to define `__FINITE_MATH_ONLY__`, but that seems doable. CC @andykaylor @jcranmer-intel https://github.com/llvm/llvm-project/pull/97342 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits