pogs icon indicating copy to clipboard operation
pogs copied to clipboard

use of unitialised data in src/cpu/include/gsl/gsl_vector.h

Open tosttost opened this issue 8 years ago • 1 comments

The "data" member is not initialised (src/cpu/include/gls/gsl_vector.h, line 27). This causes a lot of "Conditional jump or move depends on uninitialised value(s)" with valgrind.

Although I did not notice any strange behaviour, a std::fill or - according to stackoverflow - new T[n]() may be safer.

tosttost avatar Sep 20 '16 08:09 tosttost

Hi tosttost, I've followed the API of the gnu scientific library, where vector_alloc returns a vector with uninitialized elements (https://www.gnu.org/software/gsl/manual/html_node/Vector-allocation.html#Vector-allocation).

I looked through were vector_alloc is used and as far as I can tell there are no uses where the returned vector isn't initialized before use. I don't know where a conditional jump might depend on uninitialized variables. If you find a place that I missed let me know.

foges avatar Sep 17 '17 17:09 foges