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



Tobias Burnus <burnus at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|NEW                         |ASSIGNED

         AssignedTo|unassigned at gcc dot       |burnus at gcc dot gnu.org

                   |gnu.org                     |



--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-28 
10:00:42 UTC ---

(In reply to comment #3)

> Note the comment at line 728 of format.c where we must disable format caching

> when we encounter FMT_STRING.  The problem is related to saving a pointer to a

> string rather than the string itself.  That pointer can go out of scope on

> subsequent I/O operations so caching the format data will not work.



Well, one could save the data. The string is also stored in the hash:



  u->format_hash_table[hash].key = xmalloc (dtp->format_len);

  memcpy (u->format_hash_table[hash].key, dtp->format, dtp->format_len);



Thus, instead of saving it after the parsing as key, one can duplicate the

string and store it as dtp->format before parsing the string.



That's what I do in the patch, submitted at:

http://gcc.gnu.org/ml/fortran/2013-03/msg00155.html

Reply via email to