Bug 71470 - Wrong code on trunk gcc with westmere target
Summary: Wrong code on trunk gcc with westmere target
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: yarpgen
  Show dependency treegraph
 
Reported: 2016-06-09 10:14 UTC by Anton Mitrokhin
Modified: 2021-11-01 23:07 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Reproducer (690 bytes, text/plain)
2016-06-09 10:14 UTC, Anton Mitrokhin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Mitrokhin 2016-06-09 10:14:13 UTC
Created attachment 38665 [details]
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/)
Comment 1 Andrew Pinski 2016-06-19 05:59:09 UTC
Can you try this again?  There has been some patches which might have fixed this.
Comment 2 Anton Mitrokhin 2016-06-19 15:08:59 UTC
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 =)