On Thu, Sep 12, 2013 at 1:06 PM, Teresa Johnson <tejohn...@google.com> wrote: > After porting r198033 from google/4_7 to google/4_8 a test case failed > with an assert when trying to take the strlen of profile_data_prefix. > > In most cases this is either set from the directory specified to > -fprofile-generate=, or to getpwd when a directory is not specified. > However, the exception is when no directory is specified for > -fprofile-generate and -auxbase-strip option is used with the absolute > pathname. In that case the code does not set profile_data_prefix since > the filenames already have the full path. > > In the code that sets __gcov_get_profile_prefix, the fix is to simply > check if profile_data_prefix is still NULL, and if so just set via > getpwd.
Why setting it to getpwd() val? Should it be set to null instead? David > > Passes regression tests and failure I reproduced. Ok for google branches? > > Thanks, > Teresa > > 2013-09-12 Teresa Johnson <tejohn...@google.com> > > * tree-profile.c (tree_init_instrumentation): Handle the case > where profile_data_prefix is NULL. > > Index: tree-profile.c > =================================================================== > --- tree-profile.c (revision 202500) > +++ tree-profile.c (working copy) > @@ -470,8 +470,11 @@ tree_init_instrumentation (void) > DECL_ASSEMBLER_NAME (gcov_profile_prefix_decl)); > TREE_STATIC (gcov_profile_prefix_decl) = 1; > > - prefix_len = strlen (profile_data_prefix); > - prefix_string = build_string (prefix_len + 1, profile_data_prefix); > + const char *prefix = profile_data_prefix; > + if (!prefix) > + prefix = getpwd (); > + prefix_len = strlen (prefix); > + prefix_string = build_string (prefix_len + 1, prefix); > TREE_TYPE (prefix_string) = build_array_type > (char_type_node, build_index_type > (build_int_cst (NULL_TREE, prefix_len))); > > > -- > Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413