This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix handling of elem_len in CFI_establish
ClosedPublic

Authored by rovka on Apr 30 2021, 12:33 PM.

Details

Summary

The current code computes the minimum element length based on the type
used to create the descriptor and uses that as the element length
whenever it is greater than 0. This means that the elem_len parameter
is essentially ignored for any type where we can compute a minimum
element length (which includes CFI_type_char[16|32]_t), and we may
therefore end up with descriptors with a lower element length than
expected.

This patch fixes the issue by explicitly doing what the standard says,
i.e. it uses the given elem_len for character types, CFI_type_struct
and CFI_type_other, and ignores it (falls back to the minimum element
length) for everything else.

Diff Detail

Event Timeline

rovka created this revision.Apr 30 2021, 12:33 PM
klausler accepted this revision.Apr 30 2021, 3:41 PM
This revision is now accepted and ready to land.Apr 30 2021, 3:41 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 3 2021, 1:17 AM