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

--- Comment #11 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #10)
> (In reply to Mikael Morin from comment #9)
> > 
> > The following seems to fix it, and passes fortran tests *elem* and *dep*.
> > 
> No, I don't think it's correct.
> I changed the test as follows:
> 
>   call sub (p(operm), q(iperm))   ! works (properly scalarized)
>   print *, 'p(1:2)%i =', p(1:2)%i, ' (expect 44 43)'
>   p(1:2) = p(operm)             ! fails (not correctly scalarized)
>   print *, 'p(1:2)%i =', p(1:2)%i, ' (expect 43 44)'
> 
> and I get:
> 
>  p(1:2)%i =          44          43  (expect 44 43)
>  p(1:2)%i =          85          86  (expect 43 44)

Err, it's actually the expected outcome, isn't it?
Maybe the patch is correct after all.

I'm confused, the logic seems reversed in gfc_check_*_dependency.
According to the comment of gfc_check_argument_var_dependency, 'true' means no
dependency (and same for gfc_check_argument_dependency and
check_fncall_dependency), but gfc_check_fncall_dependency does:

  for (; actual; actual = actual->next, formal = formal ? formal->next : NULL)
    {
      ...
      if (gfc_check_argument_dependency (other, intent, expr, elemental))
        return 1;
    }
  return 0

So no dependency if only one argument has no dependency?

Additionally, gfc_check_dependency returns 'true' if there is a dependency and
if it returns true, then gfc_check_argument_var_dependency may return true,
which means no dependency as said above.

I will stop here, I must be missing something obvious, this is mostly working
isn't it?

Reply via email to