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

--- Comment #19 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to rguent...@suse.de from comment #15)
  Btw, I wonder what happens at
> the call boundary inside a single fortran module where
> the caller passes a dim[2] array to a subroutine
> handling arbitrary dimension arrays?  I suspect the
> IL would have the very same TBAA issue.  Can you produce
> a fortran testcase that exposes such a case so we can have a
> look into the details?

Here is a test case:

module x
  implicit none
contains
  subroutine foo(a)
    real, dimension(..) :: a
    print *,shape(a)
  end subroutine foo
  subroutine bar
    real, dimension(2,2) :: a
    real, dimension(3,3,3) :: b
    call foo(a)
    call foo(b)
  end subroutine bar
end module x

program main
  use x
  call bar
end program main

Looking at the *.original tree dump, we have

bar ()
{
  real(kind=4) a[4];
  real(kind=4) b[27];

  {
    struct array02_real(kind=4) parm.0;

[...]

    foo (&parm.0);
  }

  {
    struct array03_real(kind=4) parm.1;

[...]

    foo (&parm.1);
  }

and

foo (struct array15_real(kind=4) & restrict a)
{
  {
    struct __st_parameter_dt dt_parm.2;

This does not really look very healthy (but it is not warned about).

Reply via email to