[Bug fortran/31725] overwriting of neighbouring character array
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Apr 27 14:48:00 GMT 2007
------- Comment #2 from burnus at gcc dot gnu dot org 2007-04-27 15:47 -------
The program is broken / invalid:
function lenstr(s)
character*(*) s
do 1 l=ll,1,-1
if (s(l:l).ne.' ') goto 2
1 continue
Question: What value has "ll" ? 0, 325, -4326 ?
Depending on the compiler, anything may happen. Using NAG f95 I simply get a
coredump, using gfortran I got "This should not happen". The Intel compiler
silently sets this number to zero and runs "l = 0, 1, -1". I think neither does
the right thing.
If I add
ll = 0
all my compilers produce the same result - however meaningless/-full it might
be.
By the way, using Fortran 95, you have the function LEN_TRIM which gives the
string length without tailing blanks.
If there remains another bug, please reopen.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31725
More information about the Gcc-bugs
mailing list