[Bug fortran/64958] New: Warn if INTENT(IN) is changed by passing to no-intent argument
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 6 12:45:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64958
Bug ID: 64958
Summary: Warn if INTENT(IN) is changed by passing to no-intent
argument
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Consider the following code:
module foo
implicit none
contains
subroutine bar(n)
integer, intent(in) :: n
print *,"bar before dusty", n
call dusty(n)
print *,"bar after dusty", n
end subroutine bar
end module foo
program main
use foo
implicit none
integer :: n
n = 5
call bar(n)
end program main
subroutine dusty(n)
integer n
n = n - 1
end
What "dusty" does is illegal, but it may not be easy for the programmer
to catch this (especially if "dusty" is in a library).
So, it would be nice if -fcheck=all would contain a check which checked
if intent(in) dummy arguments are changed by being passed to
intent(none).
More information about the Gcc-bugs
mailing list