Created attachment 38665 [details]
The test fails only in case array sizes are set in a separate file. init.cpp - initializes the array, func.cpp - accesses the elements.
The test fails with 'std::out_of_range', but only on westmere -O3. Other targets/optimizations and compilers seem to work.
> g++ -std=c++11 -static-libgcc -static-libstdc++ -O3 -march=westmere -o out func.cpp init.cpp
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 3) >= this->size() (which is 0)
Aborted (core dumped)
> gcc -v:
Using built-in specs.
Configured with: /export/users/gnutester/stability/svn/trunk/configure --with-arch=corei7 --with-cpu=corei7 --enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld --enable-cloog-backend=isl --with-fpmath=sse --with-pkgversion=Revision=237240/svn-rev:237241/ --prefix=/export/users/gnutester/stability/work/trunk/64/install --enable-languages=c,c++,fortran,java,lto
Thread model: posix
gcc version 7.0.0 20160608 (experimental) (Revision=237240/svn-rev:237241/)
Can you try this again? There has been some patches which might have fixed this.
It works now, thank you.
However, the unreduced test case now fails with a segfault (again, only on westmere). I will try to reduce it and create a tracker =)