https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113377

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to anlauf from comment #0)
> The dump-tree suggests that the scalarizer sees the loop invariant j,
> unconditionally dereferences it outside the loop,

Note that the copy to the variable before the loop does NOT dereference the
pointer.
This case is explicitly supported by the scalarizer, see
gfc_scalar_elemental_arg_saved_as_reference (and
gfc_walk_elemental_function_args for the initialization of the can_be_null_ref
field).

Normally this is sufficient to support optional dummies (there is also
additional support for class wrappers in gfc_conv_procedure_call), except if
value comes into play.

> generates code that
> unconditionally dereferences j in the invocation of two, and uses a
> wrong interface:
These are the topics to investigate.
I suppose we need to duplicate (or factor) the code for optional, value dummies
that was added for non-elemental procedures in gfc_conv_procedure_call.

Reply via email to