https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71470
Bug ID: 71470 Summary: Wrong code on trunk gcc with westmere target Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: anton.mitrokhin at phystech dot edu Target Milestone: --- Created attachment 38665 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38665&action=edit Reproducer 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. Reproduce: > g++ -std=c++11 -static-libgcc -static-libstdc++ -O3 -march=westmere -o out > func.cpp init.cpp > ./out Output: 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. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/export/users/amitrokh/gcc_trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu 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/)