[flang-commits] [flang] [flang] Do not stop on mismatched DATA substring length (PR #69336)

via flang-commits flang-commits at lists.llvm.org
Wed Oct 18 00:37:57 PDT 2023


================
@@ -457,10 +457,11 @@ bool DataInitializationCompiler<DSV>::InitElement(
             folded.AsFortran(), DescribeElement());
       } else if (status == evaluate::InitialImage::OutOfRange) {
         OutOfRangeError();
-      } else if (status == evaluate::InitialImage::SizeMismatch) {
+      } else if (status == evaluate::InitialImage::LengthMismatch) {
----------------
jeanPerier wrote:

My few attempts to find a Fortran program were status would be SizeMismatch here failed (using an array as value is refused, too many/too few values is caught before, incorrect value types are casted). [SizeMismatch is returned here for instance ](https://github.com/llvm/llvm-project/blob/e93bddb2874db5520dfedecac6c6a13ffa4e7e5e/flang/include/flang/Evaluate/initial-image.h#L43).

@klausler, do you see a Fortran program that could return it without complaining about too many/too few values before? If not, are you OK with the CHECK(any fatal errors) in the fall through below, or would you rather raise some generic user error about "size mismatch in data statement" just in case?

https://github.com/llvm/llvm-project/pull/69336


More information about the flang-commits mailing list