This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/49733] Missed optimization: Variable value not propagated to remove "if" condition
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Jul 2011 14:17:42 +0000
- Subject: [Bug middle-end/49733] Missed optimization: Variable value not propagated to remove "if" condition
- Auto-submitted: auto-generated
- References: <bug-49733-4@http.gcc.gnu.org/bugzilla/>
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?)