[flang-commits] [flang] b146dfe - [flang] add attribute to trim runtime implementation establish call

Jean Perier via flang-commits flang-commits at lists.llvm.org
Wed Feb 24 09:54:54 PST 2021


Author: Jean Perier
Date: 2021-02-24T18:53:55+01:00
New Revision: b146dfe527ba81297d2949fc423e66c869bf926a

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

LOG: [flang] add attribute to trim runtime implementation establish call

CFI allocatable attribute is needed so that the descriptor for the
result can be allocated/deallocated.

Reviewed By: klausler

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

Added: 
    

Modified: 
    flang/runtime/character.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/character.cpp b/flang/runtime/character.cpp
index c241afd33fb7..9476bde63dc6 100644
--- a/flang/runtime/character.cpp
+++ b/flang/runtime/character.cpp
@@ -686,7 +686,8 @@ void RTNAME(Trim)(Descriptor &result, const Descriptor &string,
     terminator.Crash(
         "TRIM: bad string type code %d", static_cast<int>(string.raw().type));
   }
-  result.Establish(string.type(), resultBytes, nullptr, 0);
+  result.Establish(string.type(), resultBytes, nullptr, 0, nullptr,
+      CFI_attribute_allocatable);
   RUNTIME_CHECK(terminator, result.Allocate(nullptr, nullptr) == CFI_SUCCESS);
   std::memcpy(result.OffsetElement(), string.OffsetElement(), resultBytes);
 }


        


More information about the flang-commits mailing list