Opened 7 years ago

Closed 7 years ago

#11394 closed Bugs (fixed)

Sanity checks fail on unstable binomial heap when pushing elements of same weight

Reported by: anonymous Owned by: timblechmann
Milestone: To Be Determined Component: heap
Version: Boost 1.57.0 Severity: Problem
Keywords: binomial heap, unstable, sanity checks, fail Cc: charnik@…

Description

Hi, I have come across a bug according to which sanity checks fail on unstable binomial heaps when pushing elements of same weight. If sanity checks are not enabled, pushing/popping is done successfully, but in that case assertions in user code fail (I was just comparing the size of the heap with that of a counter that keeps track of the number of elements contained in the heap).

Furthermore, the result of empty() is not always aligned with that of size(), so for example empty() might report true, while size() might report 1. empty() gives always a correct result, since it just returns the result of the comparison `top_element == NULL', while size() reports the size of the size_holder, which seems that is not updated correctly. If the heap is defined as stable, there is no such problem.

Tested versions are 1.57.0 and 1.58.0 and are both affected. You may find the source code to reproduce such behavior in the attached .cpp file. There, I also include a fibonacci heap (apart from stable/unstable binomial heaps) in which the bug is not present.

Thanks, Babis

Attachments (1)

boost_binomial_heap_bug.cpp (1.5 KB ) - added by anonymous 7 years ago.
File to reproduce the bug

Download all attachments as: .zip

Change History (4)

by anonymous, 7 years ago

Attachment: boost_binomial_heap_bug.cpp added

File to reproduce the bug

comment:1 by timblechmann, 7 years ago

thanks for the reproducer ... unfortunately i won't be able to have a closer look at this atm ... so it might take some time ...

comment:2 by timblechmann, 7 years ago

fixed in develop

comment:3 by timblechmann, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.