http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49733

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-13 
14:17:38 UTC ---
is

  program test

  integer :: a

  subroutine bar()
  a = 1
  end

  subroutine sub(non_aliasing_var)
  integer :: non_aliasing_var
  non_aliasing_var = 5
  bar()
  if (non_aliasing_var /= 5) call foobar()
  end

  sub(a)
  end

invalid then?  GCC assumes that any function can modify any global
variable unless interprocedural analysis can prove otherwise.

It gets more interesting when you consider

  subroutine sub(non_aliasing_var)
  integer :: non_aliasing_var
  non_aliasing_var = 5
  sub(a)
! or even
! sub (non_aliasing_var)
  if (non_aliasing_var /= 5) call foobar()
  end

(or even hide the recursion by going through an external dispatcher)

Does that make the variable "aliased"?  Or is that invalid as well
(ok, add whatever is required to allow sub be called recursively - what then?)

Reply via email to