Skip to content

Commit

Permalink
[flang] Set the addendum when establishing pointer section in descriptor
Browse files Browse the repository at this point in the history
If the source has an addendum, the descriptor that is being established
to describe a section over the source needs to copy the addendum so that
derived type information is correctly set in the descriptor being
established.

This allows namelist IO with derived type to work correctly.

Differential Revision: https://reviews.llvm.org/D113258
  • Loading branch information
jeanPerier committed Nov 8, 2021
1 parent c42bb30 commit 4375430
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flang/runtime/descriptor.cpp
Expand Up @@ -241,6 +241,13 @@ bool Descriptor::EstablishPointerSection(const Descriptor &source,
}
}
raw_.rank = newRank;
if (const auto *sourceAddendum = source.Addendum()) {
if (auto *addendum{Addendum()}) {
*addendum = *sourceAddendum;
} else {
return false;
}
}
return CFI_section(&raw_, &source.raw_, lower, upper, stride) == CFI_SUCCESS;
}

Expand Down

0 comments on commit 4375430

Please sign in to comment.