Let me correct my answer a bit. You calculate 'which' as a sum of floating point comparisons with some "weight" from 1 to 8, but this is ok, as a result of comparison is 0 or 1. But, there might be a problem. The greatest possible 'which' is the sum of "weights" 1+2+3+4+8+12=30. (Assuming all conditionals return 1). Your ctrltab array has only 16 elements. So if one floating point conditional wrongly returns 1 (due to lack of precision) you will get out-of-bounds error. I think this is the most probable scenario 2 февр. 2016 г. 22:34 пользователь "Pierre Abbat" < [email protected]> написал:
> On 02/ 2/16 06:22 PM, Vasily Postnicov wrote: > >> Do you mean an uninitialized pointer problem? Do you have a source code >> of that software that you think causes a trouble? If you think your >> memory is corrupted because of uninitialized pointer, I suggest to >> compile problematic code with clang with AddressSanitizer. Just don't >> forget to compile llvm with compiler-rt option. I hope this helps. >> Didn't try this by myself, though >> > > It's on Github. Follow the links from http://bezitopo.org/. It's not an > uninitialized pointer, it's a double variable, which is a control point of > a Bézier triangle. The function is returning something like 1e-300 instead > of 280. I inserted a debugging statement to output "ctrlpt garbage" if it > ever returned such a number. On Linux, inserting the statement made the bug > go away, but it reappeared on DragonFly. > > I ran bezitest under Valgrind a few weeks ago and fixed some uninitialized > variables and allocation mixups. > > Pierre >
