Opened 6 years ago

Last modified 5 years ago

#12172 new Bugs

Warning in ublas/matrix_expression.hpp from GCC 6.1.0 -Wmisleading-indentation

Reported by: lopresti@… Owned by: Gunter
Milestone: To Be Determined Component: uBLAS
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

When I compile with "-Wall -Wextra -Werror", I get:

.../boost/numeric/ublas/matrix_expression.hpp:2224:17: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]

if (it2_ != it2_end_) ~

.../boost/numeric/ublas/matrix_expression.hpp:2227:21: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’

if (it2_ != it2_end_) {

This appears to be a valid warning, and lines 2227 and 2228 should be un-indented by one level. Assuming this is not a real bug, that is.

Attachments (1)

12172.patch (611 bytes ) - added by khalil.fazal@… 6 years ago.
proposed patch for bug#12172

Download all attachments as: .zip

Change History (6)

comment:1 by jzulauf@…, 6 years ago

not only is that a valid warning. The logical guarding of the if block differs in the increment function from the matching code in the "decrement" function below -- this probably needs algorithmic review, not just indentation fixing.

comment:2 by anonymous, 6 years ago

Same in 6.2.0

by khalil.fazal@…, 6 years ago

Attachment: 12172.patch added

proposed patch for bug#12172

comment:3 by khalil.fazal@…, 6 years ago

are there any unit tests my change can be tested against?

comment:4 by anonymous, 6 years ago

By pure coincidence, the two possible interpretations are equivalent. The condition being tested by the two if statements is the same, so the way it is written now is slightly less efficient, but still produces the right result. The patch proposed by khalil is probably what the original author intended.

In other words, you don't need to worry about regressions.

comment:5 by joshua.strodtbeck@…, 5 years ago

khalil's patch is consistent with 1.57. Best to find out why it changed in the first place.

Note: See TracTickets for help on using tickets.