[flang-commits] [flang] 7c7ffa7 - [flang][runtime] Fixed dimension offset computation for MayAlias.

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Mon May 15 10:48:54 PDT 2023


Author: Slava Zakharin
Date: 2023-05-15T10:48:45-07:00
New Revision: 7c7ffa7bab7e5a67cc3157c66fa5570719043ab3

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

LOG: [flang][runtime] Fixed dimension offset computation for MayAlias.

Reviewed By: klausler

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

Added: 
    

Modified: 
    flang/runtime/assign.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/assign.cpp b/flang/runtime/assign.cpp
index 88f5500588bfa..9e10e2f491ed2 100644
--- a/flang/runtime/assign.cpp
+++ b/flang/runtime/assign.cpp
@@ -129,9 +129,9 @@ static void MaximalByteOffsetRange(
     if (extent > 0) {
       auto sm{dim.ByteStride()};
       if (sm < 0) {
-        least += extent * sm;
+        least += (extent - 1) * sm;
       } else {
-        most += extent * sm;
+        most += (extent - 1) * sm;
       }
     }
   }


        


More information about the flang-commits mailing list