On Fri, Aug 02, 2024 at 06:29:27PM +0200, Mikael Morin wrote: > I agree with all of that. Sure keeping the condition around would be the > safest. I'm just afraid of keeping code that would remain dead. > > > > > And the pasto fix would guess fix > > > > aliasing_dummy_5.f90 with > > > > arg(2:3) = arr(1:2) > > > > instead of > > > > arr(2:3) = arg(1:2) > > > > if the original testcase would actually fail. > > > > > > > Mmh, aren't they both actually the same?
> They can alias, and they do alias. So in the end, writing either line is > equivalent, what do I miss? So, I had another look. Seems the reason why the testcase passes is that gfc_could_be_alias (called from gfc_conv_resolve_dependencies) returns true, so the assignment goes through a temporary array. gfc_check_dependency is then only called for if (lhs->rank > 0 && gfc_check_dependency (lhs, rhs, true) == 0) optimize_binop_array_assignment (c, &rhs, false); Guess the question is if one can construct a testcase where it would make a difference. Jakub