Print this page
5083 avoid undefined order of operations in assignments

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/intel/modules/generic_cpu/gcpu.c
          +++ new/usr/src/cmd/mdb/intel/modules/generic_cpu/gcpu.c
↓ open down ↓ 119 lines elided ↑ open up ↑
 120  120                  return (B_TRUE);
 121  121  
 122  122          /* increment the core id */
 123  123          wsp->coreid++;
 124  124          carry = wsp->coreid >> wsp->core_nbits;
 125  125          wsp->coreid = wsp->coreid & CMI_MAX_COREID(wsp->core_nbits);
 126  126          if (carry == 0)
 127  127                  return (B_TRUE);
 128  128  
 129  129          /* increment the chip id */
 130      -        wsp->chipid = ++wsp->chipid & (CMI_MAX_CHIPID);
      130 +        wsp->chipid = (wsp->chipid + 1) & (CMI_MAX_CHIPID);
 131  131  
 132  132          return (B_TRUE);
 133  133  }
 134  134  
 135  135  /*
 136  136   * Lookup for the hdl entry of a given <chip,core,strand> tuple
 137  137   */
 138  138  static cmi_hdl_ent_t *
 139  139  cmih_ent_lookup(struct cmih_walk_state *wsp)
 140  140  {
↓ open down ↓ 569 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX