https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66089
--- Comment #14 from Mikael Morin <mikael at gcc dot gnu.org> --- Created attachment 37613 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37613&action=edit Fix for comment #10 This is sufficient to fix comment #10. It removes the optional attribute on c(1) if c is optional. Then the can_be_null_ref attribute is not set during scalarization, and gfc_scalar_elemental_arg_saved_as_reference returns false. I'm not sure this is actually correct; should we consider c(1) optional if c is optional?