On Mon, 29 Aug 2022, Richard Biener wrote:

[...]

> The patch correctly diagnoses an uninitalized use of 'regnum'
> in store_bit_field_1 but also diagnoses an uninitialized use of
> best_match::m_best_candidate_len which I've chosen to silence
> without analyzing it in detail (I'm doing that right now).

To followup myself this is

  cpp_hashnode *best_macro = bmm.get_best_meaningful_candidate ();
  /* If a macro is the closest so far to NAME, use it, creating an 
     identifier tree node for it.  */
  if (best_macro)
    {
      const char *id = (const char *)best_macro->ident.str;
      tree macro_as_identifier
        = get_identifier_with_length (id, best_macro->ident.len);
      bm.set_best_so_far (macro_as_identifier,
                          bmm.get_best_distance (),
                          bmm.get_best_candidate_length ());

and

  edit_distance_t get_cutoff (size_t candidate_len) const
  {    
    return ::get_edit_distance_cutoff (m_goal_len, candidate_len);
  }    
       
  candidate_t get_best_meaningful_candidate () const
  {    
    /* If the edit distance is too high, the suggestion is likely to be
       meaningless.  */
    if (m_best_candidate)
      {
        edit_distance_t cutoff = get_cutoff (m_best_candidate_len);
        if (m_best_distance > cutoff)
          return NULL;
    }

where the connection between m_best_candidate_len being initialized
when m_best_candidate is not NULL is not visible.  I think it's
OK to initialize the member together with m_best_candidate here.

I'm reducing a testcase, but not sure where that will go.

Richard.

Reply via email to