This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51638] gfortran optimization breaks a single variable used as both input and output for subroutine call
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 Jan 2012 10:01:59 +0000
- Subject: [Bug fortran/51638] gfortran optimization breaks a single variable used as both input and output for subroutine call
- Auto-submitted: auto-generated
- References: <bug-51638-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51638
--- Comment #13 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-09 10:01:59 UTC ---
(In reply to comment #12)
> I am surprised to see that none of the compilers I tested (gfortran, ifort,
> g95) complain about the fact that the same variable is used as both
> intent(in) and intent(out) variable. Shouldn't it be at least a warning?
gfortran with -Waliasing (or -Wall) actually warns - but not by default:
call iei4ei(in4,in4)
1
Warning: Same actual argument associated with INTENT(IN) argument 'inpu' and
INTENT(OUT) argument 'oupu' at (1)
The argument agains warning by default is that one can write perfectly valid
code such as:
call iei4ei(in4, in4, false)
contains
subroutine iei4ei (out, in, mod)
integer :: out, in
logical :: mod
if (mod)
out = 5
end subroutine ie4ei
Nevertheless, one could think of warning by default.