Follow-up Comment #3, bug #22014 (project freeciv):

Unpacking the relevant code, it seems that even if the value is initialised,
it becomes uninitialised in the BV_ISSET call.  I'm not sure how this function
differs from every other use of BV_ISSET though.

Using the less dense function:


/****************************************************************************
  Initialize the road integrators cache
****************************************************************************/
void road_integrators_cache_init(void)
{
  road_type_iterate(proad) {
    proad->integrators = road_type_list_new();
    /* Roads always integrate with themselves. */
    road_type_list_append(proad->integrators, proad);
    road_type_iterate(oroad) {
      int road_idx = road_index(oroad);
      bv_roads integrates = proad->integrates;
      bool integrator = FALSE;

      integrator = BV_ISSET(integrates, road_idx); 
      if (integrator) {
        road_type_list_append(proad->integrators, oroad);
      }
    } road_type_iterate_end;
    road_type_list_unique(proad->integrators);
    road_type_list_sort(proad->integrators, &compare_road_move_cost);
  } road_type_iterate_end;
}


Valgrind now reports the same error for "if (integrator)", where integrator is
known to be initialised prior to the BV_ISSET() macro.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?22014>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to