[Bug c++/71386] New: Wrong code on c++14 (GCC trunk)
anton.mitrokhin at phystech dot edu
gcc-bugzilla@gcc.gnu.org
Thu Jun 2 13:46:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71386
Bug ID: 71386
Summary: Wrong code on c++14 (GCC trunk)
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: anton.mitrokhin at phystech dot edu
Target Milestone: ---
Created attachment 38625
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38625&action=edit
Reproducer
It looks like gcc emits wrong code with 14th standard features (or I may be
wrong). The reproducer concatenates two lists, but the last three elements
always end up to be zero on -O3, and on -O0 the last two elements a getting
trashed. Compiling with latest clang works fine.
Reproducer:
1. -O0:
> g++ -std=c++14 -O0 crash.cpp -o out
> ./out
> 3 2 1 0 -1490624600 32600
2. -O3:
> g++ -std=c++14 -O3 crash.cpp -o out
> ./out
> 3 2 1 0 0 0
3. clang:
> clang++ -fsanitize=undefined -fsanitize=memory -Wall -O3 crash.cpp -std=c++14 -o out
> ./out
> 1 2 3 1 2 3
> 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=237011/svn-rev:237016/
--prefix=/export/users/gnutester/stability/work/trunk/64/install
--enable-languages=c,c++,fortran,java,lto
Thread model: posix
gcc version 7.0.0 20160601 (experimental) (Revision=237011/svn-rev:237016/)
More information about the Gcc-bugs
mailing list