[flang-commits] [flang] [flang] Corrected constant folding for IEEE_OTHER in IEEE_ROUNDING_SUPPORTED (PR #197534)

via flang-commits flang-commits at lists.llvm.org
Wed May 13 12:04:01 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: kwyatt-ext

<details>
<summary>Changes</summary>

Modified to report expected value of FALSE for constant folded IEEE_OTHER support.

This fixes issue #<!-- -->197486.


---
Full diff: https://github.com/llvm/llvm-project/pull/197534.diff


1 Files Affected:

- (modified) flang/lib/Evaluate/fold-logical.cpp (+2-1) 


``````````diff
diff --git a/flang/lib/Evaluate/fold-logical.cpp b/flang/lib/Evaluate/fold-logical.cpp
index 457b2f6dd20b8..b685303c2a130 100644
--- a/flang/lib/Evaluate/fold-logical.cpp
+++ b/flang/lib/Evaluate/fold-logical.cpp
@@ -930,7 +930,8 @@ Expr<Type<TypeCategory::Logical, KIND>> FoldIntrinsicFunction(
     if (context.targetCharacteristics().ieeeFeatures().test(
             IeeeFeature::Rounding)) {
       if (auto mode{GetRoundingMode(args[0])}) {
-        return Expr<T>{mode != common::RoundingMode::TiesAwayFromZero};
+        return Expr<T>{mode >= common::RoundingMode::ToZero &&
+            mode < common::RoundingMode::TiesAwayFromZero};
       }
     }
   } else if (name == "__builtin_ieee_support_sqrt") {

``````````

</details>


https://github.com/llvm/llvm-project/pull/197534


More information about the flang-commits mailing list