[Flang-dev] f18 and PRESENT

Troy Johnson troyj at cray.com
Fri Oct 12 11:51:57 EDT 2018

I'm curious how f18 will translate PRESENT (Fortran 2018 16.9.152) given the various checks imposed by  There seems to be a trend toward using OPTIONAL arguments, which then litters code with PRESENT checks, frequently inside loops.  Sometimes it's possible for a compiler to hoist the check and version the loop, but the difficulty of that process depends on how PRESENT is expanded.  Will it be a single conditional or multiple nested conditionals?  For example, for an OPTIONAL ALLOCATABLE dummy argument, one might need PRESENT to be something like:

      ! code originally guarded by IF (PRESENT(X))
    END IF

So then an optimization pass that tries to hoist PRESENT from loops is faced with two nested conditions as opposed to one.  I suppose the number of checks might depend on the dope vector format that f18 intends to use.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20181012/617a0256/attachment-0001.html>

More information about the flang-dev mailing list