[flang-commits] [flang] f6aac0d - [flang] Fix DOT_PRODUCT for logical

peter klausler via flang-commits flang-commits at lists.llvm.org
Fri Oct 22 15:59:06 PDT 2021


Author: peter klausler
Date: 2021-10-22T15:56:20-07:00
New Revision: f6aac0dd4d130a41785fd320fb66377631557f6c

URL: https://github.com/llvm/llvm-project/commit/f6aac0dd4d130a41785fd320fb66377631557f6c
DIFF: https://github.com/llvm/llvm-project/commit/f6aac0dd4d130a41785fd320fb66377631557f6c.diff

LOG: [flang] Fix DOT_PRODUCT for logical

A build-time check in a template class instantiation was applying
a test that's meaningful only for numeric types.

Differential Revision: https://reviews.llvm.org/D112345

Added: 
    

Modified: 
    flang/runtime/dot-product.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/dot-product.cpp b/flang/runtime/dot-product.cpp
index 4b8029768b95..4b2873222859 100644
--- a/flang/runtime/dot-product.cpp
+++ b/flang/runtime/dot-product.cpp
@@ -111,7 +111,7 @@ template <TypeCategory RCAT, int RKIND> struct DotProduct {
         if constexpr (constexpr auto resultType{
                           GetResultType(XCAT, XKIND, YCAT, YKIND)}) {
           if constexpr (resultType->first == RCAT &&
-              resultType->second <= RKIND) {
+              (resultType->second <= RKIND || RCAT == TypeCategory::Logical)) {
             return DoDotProduct<RCAT, RKIND, CppTypeFor<XCAT, XKIND>,
                 CppTypeFor<YCAT, YKIND>>(x, y, terminator);
           }


        


More information about the flang-commits mailing list