#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)
Change History (11)
Changed 11 years ago by
Attachment: | 39d27d0b7939.patch added |
---|
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
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 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
A rebased version [15e233f588da] has been merged to branches 1.3 and default.
comment:4 follow-up: 6 Changed 11 years ago by
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 11 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:6 follow-up: 7 Changed 11 years ago by
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 Changed 11 years ago by
Replying to alpar:
That strange - everything is fine in
Maintainer/Debug
mode, even withvalgrind
, but it indeed fails inRelease
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 11 years ago by
Attachment: | 1ba759c76810.patch added |
---|
comment:8 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
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.
I think [39d27d0b7939] (see the attachment) resolves the issue. Could anyone confirm, please?