[Bug fortran/30200] valgrind errors for write statement

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Dec 13 19:48:00 GMT 2006



------- Comment #2 from burnus at gcc dot gnu dot org  2006-12-13 19:47 -------
Simplified version (might not cover all problems):
   character(len=20) myfmt
   myfmt="(1X,a,'x')"
   WRITE(*,fmt=trim(myfmt)) "y"
   END

If one looks now at the dump:
    _gfortran_string_trim (&len.2, (void * *) &pstr.1, 20, &myfmt);
    dt_parm.0.format = pstr.1;
    dt_parm.0.format_len = len.2;
    _gfortran_st_write (&dt_parm.0);
        _gfortran_internal_free (pstr.1);
    _gfortran_transfer_character (&dt_parm.0, "y", 1);
    _gfortran_st_write_done (&dt_parm.0);

I'm not sure whether this is the problem, but pstr.1 is freed before "y" is
send to "write" - but the string has to be written after "y".


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2006-12-13 19:47:50
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30200



More information about the Gcc-bugs mailing list