Boost logo

Boost :

Subject: Re: [boost] Valgrind reports use of uninitialized value in any_range
From: Neil Groves (neil_at_[hidden])
Date: 2015-10-16 03:15:48

On 16 October 2015 at 07:45, Auer, Jens <jens.auer_at_[hidden]> wrote:
> Hi,
> I am using an any_range of std::unique_ptr values in one of my programs. When I analyse this with valgrind, it reports many uninitialized value usages in any_range, and I cannot explain this from my code. I managed to produce a small example to reproduce this. I would like to know if that is a real issue, or if can just create a valgrind suppression rule.

It's safe to ignore under all compilers and platforms, under all
use-cases, that I have tried. Please see the Boost test matrix to
confirm correct functioning. It is due to a sub-optimal implementation
that I did for the underlying iterator small buffer optimisation. The
any_iterator_buffer uses a boost::array<char,N> as a target for a
placement new. I hope that by updating this code to use
aligned_storage that the warning will go away. Since the start of the
array is merely used (in the any_iterator implementation) as an
argument to placement new I believe the alignment issues are
irrelevant unless the type of the value_type is almost 64 bytes and
the alignment of the value_type is greater than the alignment of the
array. In practice, on the vast majority of platforms / compilers,
this doesn't present a real problem. I'm sorry for the confusion my
mistake has caused.

I need to address this soon.

> Best wishes,
> Jens
> PS: I've sent this to boost-users yesterday, but I now think that boost-devel is a better match.


Boost list run by bdawes at, gregod at, cpdaniel at, john at