Out-of-bounds access in insertionSortParallel

I wanted to do some performance benchmarks of vecorization and maximum optimizations of high precision Real, and accidentally discovered this crash.

I just discovered that 002c1c94 causes segfault in yade --performance -j16. I checked out 477ab814 and it worked, then I cherry picked this commit and it crashed.

@gladk What compilation error, and on what platform did you have there?

I will prepare a merge request that will add a much shorter version of yade --performance -j16 to the pipeline, we don't want this to happen again.

UPD 20200124

As stated here, there is an out-of-bound problems in insertionSortParallel and it should be fixed.

AddressSanitizer-output:

==1137==ERROR: AddressSanitizer: SEGV on unknown address 0x7fe3dd25e7f0 (pc 0x7fcc03a4279b bp 0x7fcbd7974e30 sp 0x7fcbd7974bf0 T37)
==1137==The signal is caused by a READ memory access.
    #0 0x7fcc03a4279a in yade::InsertionSortCollider::insertionSortParallel(yade::InsertionSortCollider::VecBounds&, yade::InteractionContainer*, yade::Scene*, bool) [clone ._omp_fn.0] trunk/pkg/common/InsertionSortCollider.cpp:119                 
    #1 0x7fcbfaeac79d  (/lib/x86_64-linux-gnu/libgomp.so.1+0x1679d)
    #2 0x7fcc0b814fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
    #3 0x7fcc0b35b4ce in clone (/lib/x86_64-linux-gnu/libc.so.6+0xf94ce)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV trunk/pkg/common/InsertionSortCollider.cpp:119 in yade::InsertionSortCollider::insertionSortParallel(yade::InsertionSortCollider::VecBounds&, yade::InteractionContainer*, yade::Scene*, bool) [clone ._omp_fn.0]       
Thread T37 created by T24 here:
    #0 0x7fcc0b8fadb0 in __interceptor_pthread_create (//lib/x86_64-linux-gnu/libasan.so.5+0x50db0)
    #1 0x7fcbfaeacd61  (/lib/x86_64-linux-gnu/libgomp.so.1+0x16d61)
    #2 0x7fcbfaea3e09 in GOMP_parallel (/lib/x86_64-linux-gnu/libgomp.so.1+0xde09)
    #3 0x61700018d667  (<unknown module>)

Thread T24 created by T0 here:
    #0 0x7fcc0b8fadb0 in __interceptor_pthread_create (//lib/x86_64-linux-gnu/libasan.so.5+0x50db0)
    #1 0x7fcbffd1968a in boost::thread::start_thread_noexcept() (/lib/x86_64-linux-gnu/libboost_thread.so.1.67.0+0x1368a)

==1137==ABORTING
Edited by Anton Gladky