[flang] Handle correctly optional intrinsic scalar to unlimited polymorphic optional
authorValentin Clement <clementval@gmail.com>
Mon, 13 Feb 2023 14:42:25 +0000 (15:42 +0100)
committerValentin Clement <clementval@gmail.com>
Mon, 13 Feb 2023 14:44:12 +0000 (15:44 +0100)
commitd904ee3d479a0731b2f0918c057081283102f790
treefa470e67cad0c3849d734fb5dce5f32ed23e9a67
parent877859a09bda29fe9a7f1a9016b06cf80661a032
[flang] Handle correctly optional intrinsic scalar to unlimited polymorphic optional

When an optional intrinsic scalar is passed to a function expecting an
unlimited polymorphic dummy argument, the presence test must be done
before the emboxing otherwise it will result in a program crash.

Depends on D143888

Reviewed By: jeanPerier, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D143889
flang/lib/Lower/ConvertExpr.cpp
flang/test/Lower/polymorphic.f90