[flang-commits] [PATCH] D99296: [flang] Fix runtime crash on TRIM('')
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Mar 25 10:20:55 PDT 2021
klausler added a comment.
In D99296#2649900 <https://reviews.llvm.org/D99296#2649900>, @jeanPerier wrote:
> Regarding `CFI_establish`, the Fortran standard says in 18.5.5.5 about `elem_len` :
>
>> elem_len: If type is equal to CFI_type_struct, CFI_type_other, or a Fortran character type code, **elem_len shall be greater than zero** and equal to the storage size in bytes of an element of the object. Otherwise, elem_len will be ignored.
>
> So it look like the implementation/unittests are following the standard. But it is weird that it should be forbidden to establish zero length characters in the C interoperability context. I see no harm in that, so I am OK with your change.
>
> However, do zero sized struct/ CFI_type_other make sense ? I guess in the C interoperability context, empty structs are not thing since they are technically illegal in C, but outside of the C interoperability context, I do not think empty derived types are forbidden.
I'm going to rework things so that CFI_establish will adhere to the standard and then change the failing CHECK that's calling it to allow for a bad element length.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99296/new/
https://reviews.llvm.org/D99296
More information about the flang-commits
mailing list