Am 18.12.24 um 22:05 schrieb Steve Kargl:
On Wed, Dec 18, 2024 at 01:11:14PM +0100, Harald Anlauf wrote:

I haven't looked close enough, but you may have to add support
for 'asis' being an optional dummy variable.  The following
example crashes here with a segfault:


(program snipped for brevity)


There are other intrinsics with optional arguments that are inlined
and where we need to check the case of optional dummies.
Look for uses of gfc_conv_expr_present().

Well, that's a bummer.  Someone smarter than I will need to
deal with the special case you found.


Steve,

have a look e.g. at gfc_conv_intrinsic_ishftc, which has a third
optional argument (SIZE):

      /* Treat optional SIZE argument when it is passed as an optional
         dummy.  If SIZE is absent, the default value is BIT_SIZE(I).  */
      if (size->expr_type == EXPR_VARIABLE
          && size->symtree->n.sym->attr.dummy
          && size->symtree->n.sym->attr.optional)
        {
          tree type_of_size = TREE_TYPE (args[2]);
          args[2] = build3_loc (input_location, COND_EXPR, type_of_size,
                                gfc_conv_expr_present (size->symtree->n.sym),
                                args[2], fold_convert (type_of_size, nbits));
        }

Also look at the context.  You should be able to convert this into the
form needed for the ASIS argument.


Reply via email to