second try to implement changes suggested in issue #888

In src/rcb.cpp:460 there is an if (smaller > largest).
now if we have one particle you will see that lo[] = hi[] and because
of this smaller == largest == 0 for all values of dim. This causes
this particular part of the code to never be run. In particular the
memcpy inside this if is never executed. This causes an unitialized
memory access in line 472. Additionally, dim is initialized with -1
and thus the accesses in 484 and 485 are problematic. Additionally,
valuehalf_select is never initialized either.

closes #888
This commit is contained in:
Axel Kohlmeyer
2018-05-18 06:43:23 -04:00
parent c960b9295c
commit d10a470245
2 changed files with 15 additions and 1 deletions

View File

@ -243,7 +243,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt,
// dotmark_select = dot markings in that dimension
int dim_select = -1;
double largest = 0.0;
double largest = -1.0;
for (dim = 0; dim < dimension; dim++) {