[flang] Lowering passing variables to OPTIONAL VALUE
The case where the dummy argument is OPTIONAL was missing in the handling of VALUE numerical and logical dummies (passBy::BaseAddressValueAttribute). This caused segfaults while unconditionally copying actual arguments that were legally absent at runtime. Takes this bug as an opportunity to share the code that lowers arguments that must be passed by BaseAddress, BaseAddressValueAttribute, BoxChar, and CharBoxValueAttribute. It has to deal with the exact same issues (being able to make contiguous copies of the actual argument, potentially conditionally at runtime, and potentially requiring a copy-back). The VALUE case is the same as the non value case, except there is never a copy-back and there is always a copy-in for variables. This two differences are easily controlled by a byValue flag. This as the benefit of implementing CHARACTER, VALUE for free that was previously a hard TODO. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D128418 Co-authored-by:Jean Perier <jperier@nvidia.com>
Loading
Please sign in to comment