1717
1818namespace Fortran ::runtime {
1919
20+ enum AssignFlags {
21+ NoAssignFlags = 0 ,
22+ MaybeReallocate = 1 << 0 ,
23+ NeedFinalization = 1 << 1 ,
24+ CanBeDefinedAssignment = 1 << 2 ,
25+ ComponentCanBeDefinedAssignment = 1 << 3 ,
26+ ExplicitLengthCharacterLHS = 1 << 4 ,
27+ PolymorphicLHS = 1 << 5 ,
28+ DeallocateLHS = 1 << 6
29+ };
30+
2031// Predicate: is the left-hand side of an assignment an allocated allocatable
2132// that must be deallocated?
2233static inline RT_API_ATTRS bool MustDeallocateLHS (
@@ -239,8 +250,8 @@ static RT_API_ATTRS void BlankPadCharacterAssignment(Descriptor &to,
239250// of elements, but their shape need not to conform (the assignment is done in
240251// element sequence order). This facilitates some internal usages, like when
241252// dealing with array constructors.
242- RT_API_ATTRS void Assign (Descriptor &to, const Descriptor &from,
243- Terminator &terminator, int flags, MemmoveFct memmoveFct ) {
253+ RT_API_ATTRS static void Assign (
254+ Descriptor &to, const Descriptor &from, Terminator &terminator, int flags) {
244255 bool mustDeallocateLHS{(flags & DeallocateLHS) ||
245256 MustDeallocateLHS (to, from, terminator, flags)};
246257 DescriptorAddendum *toAddendum{to.Addendum ()};
@@ -412,14 +423,14 @@ RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
412423 Assign (toCompDesc, fromCompDesc, terminator, nestedFlags);
413424 } else { // Component has intrinsic type; simply copy raw bytes
414425 std::size_t componentByteSize{comp.SizeInBytes (to)};
415- memmoveFct (to.Element <char >(toAt) + comp.offset (),
426+ Fortran::runtime::memmove (to.Element <char >(toAt) + comp.offset (),
416427 from.Element <const char >(fromAt) + comp.offset (),
417428 componentByteSize);
418429 }
419430 break ;
420431 case typeInfo::Component::Genre::Pointer: {
421432 std::size_t componentByteSize{comp.SizeInBytes (to)};
422- memmoveFct (to.Element <char >(toAt) + comp.offset (),
433+ Fortran::runtime::memmove (to.Element <char >(toAt) + comp.offset (),
423434 from.Element <const char >(fromAt) + comp.offset (),
424435 componentByteSize);
425436 } break ;
@@ -465,14 +476,14 @@ RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
465476 const auto &procPtr{
466477 *procPtrDesc.ZeroBasedIndexedElement <typeInfo::ProcPtrComponent>(
467478 k)};
468- memmoveFct (to.Element <char >(toAt) + procPtr.offset ,
479+ Fortran::runtime::memmove (to.Element <char >(toAt) + procPtr.offset ,
469480 from.Element <const char >(fromAt) + procPtr.offset ,
470481 sizeof (typeInfo::ProcedurePointer));
471482 }
472483 }
473484 } else { // intrinsic type, intrinsic assignment
474485 if (isSimpleMemmove ()) {
475- memmoveFct (to.raw ().base_addr , from.raw ().base_addr ,
486+ Fortran::runtime::memmove (to.raw ().base_addr , from.raw ().base_addr ,
476487 toElements * toElementBytes);
477488 } else if (toElementBytes > fromElementBytes) { // blank padding
478489 switch (to.type ().raw ()) {
@@ -496,8 +507,8 @@ RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
496507 } else { // elemental copies, possibly with character truncation
497508 for (std::size_t n{toElements}; n-- > 0 ;
498509 to.IncrementSubscripts (toAt), from.IncrementSubscripts (fromAt)) {
499- memmoveFct (to.Element <char >(toAt), from. Element < const char >(fromAt ),
500- toElementBytes);
510+ Fortran::runtime::memmove (to.Element <char >(toAt),
511+ from. Element < const char >(fromAt), toElementBytes);
501512 }
502513 }
503514 }
0 commit comments