Question

I have a C++ program which works well when I compile with no additional options. However, whenever I use cmake -DCMAKE_BUILD_TYPE=Release there is a very specific part of the code which stops working.

Concretely, I have an interface for a Boost Fibonacci Heap. I am calling this function:

narrow_band_.push(myObject);

And this function does the following:

inline void myHeap::push (myStruct & c) {
    handles_[c.getIndex()] = heap_.push(c);
}

where heap_ is:

boost::heap::fibonacci_heap<myStruct, boost::heap::compare<compare_func>> heap_;

For some reason the heap_size is not being modified, therefore the rest of the code does not work because the next step is to extract the minimum from the heap and it is always empty.

In Debug mode it works ok. Thank you for your help.

EDIT - Additional info I have also found this problem: I have a set of code which do simple math operations. In Release mode the results are incorrect. If I just do cout of a couple of variables to check their values, the result changes, which is still incorrect but quite strange.

Was it helpful?

Solution

I solved the problem. It was funny but in this case it was not initialization/timing issues common in the Release mode. It was that the return statement was missing in a couple of functions. In debug mode the output was perfect but in the release mode that failed. I had warnings deactivated, that is why I did not see it before.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top