Octave

Copy-Paste

V523 The ‘then’ statement is equivalent to the ‘else’ statement. matrix_type.cc 312

DEFUN(....)
{
  ....
  if (str_typ == "upper")
    mattyp.mark_as_permuted(len, p);
  else
    mattyp.mark_as_permuted(len, p); 
  ....    
}

There is no need to remind you that one should be very careful using the copy-paste technique when writing similarly looking constructs to avoid errors like this. It is doubtful that there should be two identical statements in the if-else block; a much more likely thing is that the mark_as_unpermuted method should be called when the else branch is triggered. Moreover, the programmer copied a part of code containing this buggy block to use in one more function later in the code, thus duplicating the error.

Please click here to see more bugs from this project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s