Skip to content

Incorrect delete in uvm_run_test_callback #26

@jrefice

Description

@jrefice

Inside of uvm_run_test_callback, the delete method is implemented as:

// Removes cb from the list of callbacks to be processed. The method returns 1 if cb is in the list of callbacks;
// otherwise, a 0 is returned. If cb is null, 0 is returned.
function bit uvm_run_test_callback::delete( uvm_run_test_callback cb );
  int cb_idxs[$];

  if ( cb == null ) begin
    return 0;
  end

  cb_idxs = m_registered_cbs.find_index( item ) with ( item == cb );
  foreach ( cb_idxs[ i ] ) begin
    m_registered_cbs.delete( i ); // Danger Will Robinson!
  end
  return ( cb_idxs.size() > 0 );
endfunction

Note that we always delete i, which will always be 0. We should be deleting cb_idxs[i], which is the found index.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions