https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64952
--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> --- Hello Paul, setting potentially_aliased should be done inside gfc_walk_elemental_function_args, as the ss argument may be returned unmodified. In fact, I think it's better to do all the trans-array.c code inside gfc_conv_resolve_dependencies without adding the gfc_ss_info flag. There is also the case of typebound procedures and procedure pointer components, for which we should generate a temporary in any case. I think this case is something that was overlooked by the standard commitee when they introduced the PURE attribute. Maybe they can provide some kind of "REALLY_PURE" attribute (or PURE ELEMENTAL, different from regular ELEMENTAL) that avoids generating temporaries everywhere? Or maybe the function Fred should bee IMPURE ELEMENTAL? Anyway, I think we should not rush to fix this before we are sure that the standard committee really expects temporaries (almost) everywhere array elemental functions are involved.