[PATCH] D99296: [flang] Fix runtime crash on TRIM('')

Jean Perier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 25 01:19:05 PDT 2021


jeanPerier added a comment.

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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99296/new/

https://reviews.llvm.org/D99296



More information about the llvm-commits mailing list