COIN-OR::LEMON - Graph Library

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#476 closed defect (fixed)

tsp_test fails (vector overindexing)

Reported by: Alpar Juttner Owned by: Peter Kovacs
Priority: critical Milestone: LEMON 1.4 release
Component: core Version: hg main
Keywords: Cc:
Revision id:

Description

tsp_test fails due to some `std::vector overindexing. It can be reproduced either

  • by running it under VS, where the range check is turned on in debug mode.
  • by running it with valgrind on linux.

Note that there LEMON has a TEST_WITH_VALGRIND cmake config parameter:

cmake -DCMAKE_BUILD_TYPE=Maintainer -DTEST_WITH_VALGRIND=YES ..
make

Attachments (2)

39d27d0b7939.patch (1.2 KB) - added by Alpar Juttner 10 years ago.
1ba759c76810.patch (670 bytes) - added by Alpar Juttner 10 years ago.

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by Alpar Juttner

Attachment: 39d27d0b7939.patch added

comment:1 Changed 10 years ago by Alpar Juttner

I think [39d27d0b7939] (see the attachment) resolves the issue. Could anyone confirm, please?

comment:2 Changed 10 years ago by Peter Kovacs

I agree with this modification. Maybe the wrong order was due to an incautious performance consideration (as the min_edge==INVALID condition holds only for the first iteration of the loop). But it is definitely wrong, so it should be fixed using the patch.

comment:3 Changed 10 years ago by Alpar Juttner

Resolution: fixed
Status: newclosed

A rebased version [15e233f588da] has been merged to branches 1.3 and default.

comment:4 Changed 10 years ago by Gábor Gévay

This test still fails on my machine (GCC 4.8.2, Arch Linux) with

/home/gabor/lemon_proba/lemon-main/test/tsp_test.cc:137: error: Nearest Neighbor: Wrong total cost Aborted (core dumped)

comment:5 Changed 10 years ago by Peter Kovacs

Resolution: fixed
Status: closedreopened

comment:6 in reply to:  4 ; Changed 10 years ago by Alpar Juttner

Replying to ggabor:

This test still fails on my machine (GCC 4.8.2, Arch Linux) with

/home/gabor/lemon_proba/lemon-main/test/tsp_test.cc:137: error: Nearest Neighbor: Wrong total cost Aborted (core dumped)

That strange - everything is fine in Maintainer/Debug mode, even with valgrind, but it indeed fails in Release mode. That's usually mean quite a headache to locate the problem.

comment:7 in reply to:  6 Changed 10 years ago by Gábor Gévay

Replying to alpar:

That strange - everything is fine in Maintainer/Debug mode, even with valgrind, but it indeed fails in Release mode. That's usually mean quite a headache to locate the problem.

There is a new flag in gcc 4.8, -Og, which turns on only those optimizations that don't severely interfere with debugging. It might help a little.

Changed 10 years ago by Alpar Juttner

Attachment: 1ba759c76810.patch added

comment:8 Changed 10 years ago by Alpar Juttner

Resolution: fixed
Status: reopenedclosed

Ok, this is just the usual bug of passing a temporary to a constructor parameter in test/tsp_test.cc. The attached commit [1ba759c76810] fixes the problem.

The fix is already merged into branch 1.3 and the main one.

comment:9 Changed 10 years ago by Peter Kovacs

I'm sorry for the bug. Alpár, thanks for fixing it.

Note: See TracTickets for help on using tickets.