This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30450] calling subroutine with constant parameter
- From: "milan at cmm dot ki dot si" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jan 2007 18:23:40 -0000
- Subject: [Bug fortran/30450] calling subroutine with constant parameter
- References: <bug-30450-3791@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from milan at cmm dot ki dot si 2007-01-12 18:23 -------
Subject: Re: calling subroutine with constant parameter
>>>>> "pinskia" == pinskia at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org> writes:
pinskia> ------- Comment #1 from pinskia at gcc dot gnu dot org
pinskia> 2007-01-12 17:58 ------- The only use is to change the
pinskia> value of "1" :).
pinskia> Gfortran is correct as this behavior is undefined as you
pinskia> are trying to change the value of the constant 1. in
pinskia> Fortran all agruments are passed as reference. This has
pinskia> been what Fortran has done for years.
Yes but in my case the compiler should create a temporary variable and
use that in a real call to subroutine. Passing 1 to the the subroutine
is just telling the compiler I am not interested in the final value of
this parameter in the calling routine. But in some other places in the
code this valus is important. I think this is what the compilers did
in the old VAX times and I guess some other compilers do it also
now. Since gfortran/gcc is so good (within 10% of ifort, sometimes
faster sometimes slower) I lost interest in any other compiler, so I
don't have anything handy to compile this program with say ifort.
pinskia> Oh and this is not an issue that was introduced by the
pinskia> change over to gfortran from g77. g77 also segfaulted on
pinskia> your undefined code.
I couldn't remember this for sure, but I know this problem for long
time already. Only I just fixed a bug in a very old program and
couldn't beleive it is still there. I think gfortran is more picky
when something goes wrong in the program and reports an error, while
others just go on with some stupid values :-(
I am still not convinced this is not standard complying.
Milan
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30450