[flang-commits] [PATCH] D132677: [flang][runtime] Fix MINVAL([CHARACTER(2)::])

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Aug 25 14:31:34 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG15e997ac014b: [flang][runtime] Fix MINVAL([CHARACTER(2)::]) (authored by klausler).

Changed prior to commit:
  https://reviews.llvm.org/D132677?vs=455644&id=455716#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132677

Files:
  flang/runtime/extrema.cpp


Index: flang/runtime/extrema.cpp
===================================================================
--- flang/runtime/extrema.cpp
+++ flang/runtime/extrema.cpp
@@ -423,12 +423,10 @@
     if (extremum_) {
       std::memcpy(p, extremum_, byteSize);
     } else {
-      // empty array
-      if constexpr (KIND == 1) { // ASCII
-        *p = IS_MAXVAL ? 0 : 127; // 127 required by standard
-      } else {
-        std::memset(p, IS_MAXVAL ? 0 : 255, byteSize);
-      }
+      // Empty array; fill with character 0 for MAXVAL.
+      // For MINVAL, fill with 127 if ASCII as required
+      // by the standard, otherwise set all of the bits.
+      std::memset(p, IS_MAXVAL ? 0 : KIND == 1 ? 127 : 255, byteSize);
     }
   }
   bool Accumulate(const Type *x) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132677.455716.patch
Type: text/x-patch
Size: 764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220825/a7f00f7e/attachment.bin>


More information about the flang-commits mailing list