octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help needed with suspicious code in Sparse.cc


From: Rik
Subject: Re: Help needed with suspicious code in Sparse.cc
Date: Wed, 24 Feb 2016 10:07:51 -0800

On 02/24/2016 09:43 AM, address@hidden wrote:
Subject:
Help needed with suspicious code in Sparse.cc
From:
"John W. Eaton" <address@hidden>
Date:
02/24/2016 09:19 AM
To:
Octave Maintainers List <address@hidden>
CC:
address@hidden
List-Post:
<mailto:address@hidden>
Content-Transfer-Encoding:
7bit
Precedence:
list
MIME-Version:
1.0
Message-ID:
<address@hidden>
Content-Type:
text/plain; charset=utf-8; format=flowed
Message:
2

Clang is generating the following warning:

  Sparse.cc:136:18: warning: explicitly assigning value of variable of type 'octave_idx_type' (aka 'int') to itself [-Wself-assign]
    for (i = i; i < u; i++)
         ~ ^ ~

The same thing appears on line 946 in that file.

It looks to me as if the code is correct, but the warning could be avoided if the loop were written as

  for (; i < u; i++)

Could someone who understands the sparse matrix code comment?

Yes, that looks correct to me.

I made the proposed change and also instrumented the code with a printf statement;  I do get hits when running 'make check' and the regression tests pass so it seems safe.

--Rik

reply via email to

[Prev in Thread] Current Thread [Next in Thread]