[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
This commit is contained in:
Jean Perier 2021-02-24 18:53:03 +01:00
parent c1706f2269
commit b146dfe527

View file

@ -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);
}