Closed mo-xiaoming closed 2 years ago
when std::array
used as a std::map
key, all elements in array are used, they must be initialized
There is another error reported by valgrind
in Arrays.C:WithStdVector
==3779368== Invalid read of size 32
==3779368== at 0xAE3C06C: ???
==3779368== by 0x51F7ED: TestCoord::runTestGroups(Args const&) (Main.C:64)
==3779368== by 0x5203C0: main (Main.C:143)
==3779368== Address 0x4e61d50 is 0 bytes inside a block of size 4 alloc'd
==3779368== at 0x483EDA9: operator new(unsigned long) (in /nix/store/j5dkzyl1hq51rk84mmw9yn4h5kx7n1iv-valgrind-3.16.1/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3779368== by 0x479825: __gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*) (new_allocator.h:115)
==3779368== by 0x478DD2: std::allocator_traits<std::allocator<int> >::allocate(std::allocator<int>&, unsigned long) (alloc_traits.h:460)
==3779368== by 0x478123: std::_Vector_base<int, std::allocator<int> >::_M_allocate(unsigned long) (stl_vector.h:346)
==3779368== by 0x476AB0: void std::vector<int, std::allocator<int> >::_M_range_initialize<int const*>(int const*, int const*, std::forward_iterator_tag) (stl_vector.h:1582)
==3779368== by 0x475AA1: std::vector<int, std::allocator<int> >::vector(std::initializer_list<int>, std::allocator<int> const&) (stl_vector.h:629)
==3779368== by 0x4744B5: test_Arrays_WithStdVector() (Arrays.C:54)
==3779368== by 0x51F7ED: TestCoord::runTestGroups(Args const&) (Main.C:64)
==3779368== by 0x5203C0: main (Main.C:143)
I think this is a false positive, and can be safely suppressed. The following line is the offender
0xae3c06c: vmovups (%r12),%ymm0
(%r12)
is an address on 32bytes boundary inside (or on the right boundary) vector data, and jitted code tries to load following data by vectorization, it always tries to load it in a 32bytes batch. valgrind
considers this as a reading violation when reading after vector boundary
There is a very old valgrind bug report, Bug 264936 - vectorization might lead to 'false positives', after 10 years, it is still there
Ran
hobbes-test --tests Storage
withvalgrind
, got two types of errorsand