https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107193

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
     gimple *last = last_stmt (bb);
      location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
      location_t curr_locus = UNKNOWN_LOCATION;
      int curr_discr = 0;

      /* Traverse the basic block, if two function calls within a basic block
        are mapped to the same line, assign a new discriminator because a call
        stmt could be a split point of a basic block.  */
      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
        {
          gimple *stmt = gsi_stmt (gsi);
          expanded_location curr_locus_e;
          if (curr_locus == UNKNOWN_LOCATION)
            {
              curr_locus = gimple_location (stmt);
              curr_locus_e = expand_location (curr_locus);
            }
          else if (!same_line_p (curr_locus, &curr_locus_e, gimple_location
(stmt)))
            {
              curr_locus = gimple_location (stmt);
              curr_locus_e = expand_location (curr_locus);
              curr_discr = 0;
            }
          else if (curr_discr != 0)
            {
              location_t loc = gimple_location (stmt);
              location_t dloc = location_with_discriminator (loc, curr_discr);
              gimple_set_location (stmt, dloc);
            }
          /* Allocate a new discriminator for CALL stmt.  */
          if (gimple_code (stmt) == GIMPLE_CALL)
            curr_discr = next_discriminator_for_locus (curr_locus);
        }

      if (locus == UNKNOWN_LOCATION)
          Will it be changed by the loop above?
        continue;

Reply via email to