> Hello!
> 
> There is a problem with multiple calls of cgraph_node_name in fprintf
> dumps. Please note that C++ uses caching in
> cxx_printable_name_internal (aka LANG_HOOKS_DECL_PRINTABLE_NAME), so
> when cxx_printable_name_internal is called multiple times from printf
> (i.e. fprintf "%s/%i -> %s/%i"), it can happen that the first string
> gets evicted by the second call, before fprintf is fully evaluated.
> 
> Attached patch audits all uses of cgraph_node_name, and in case of
> multiple calls in dump fprintf, wraps every call in xstrdup. This
> fixes valgrind report in the PR, as well as original dump failure on
> alpha [1].
> 
> I think that small memory leak is tolerable here (the changes are
> exclusively in the dump code), and follows the same approach as in
> java frontend.

Hmm, it is somewhat ugly, but I guess it is OK.
I was not aware that the printable names are getting released.
Thanks!

Honza

Reply via email to