public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/98516] New: Wrong code generated by tree vectorizer
@ 2021-01-04 17:01 martin@mpa-garching.mpg.de
  2021-01-04 18:59 ` [Bug tree-optimization/98516] " martin@mpa-garching.mpg.de
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: martin@mpa-garching.mpg.de @ 2021-01-04 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98516

            Bug ID: 98516
           Summary: Wrong code generated by tree vectorizer
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: martin@mpa-garching.mpg.de
  Target Milestone: ---

Created attachment 49879
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49879&action=edit
Code to reproduce the problem

The attached code is a distilled test case from an FFT library, which works
fine with current released GCC versions, but produces incorrect results with
current trunk when tree optimization is switched on via -O3:

martin@debian:~/codes/ducc$ g++ -I src/ -std=c++17 -O3 -march=native
-ffast-math bug.cc
martin@debian:~/codes/ducc$ ./a.out
(0.362978,0.601326) (0.362155,0.18782) (1.63193,-0.0779749) (1.26662,0.327246)
(-1.0024,1.03302) 

The third complex number in the result line is wrong.
When disabling tree vectorization (or when using a released GCC version), the
correct answer is produced:

martin@debian:~/codes/ducc$ g++ -I src/ -std=c++17 -O3 -march=native
-ffast-math bug.cc -fno-tree-vectorize
martin@debian:~/codes/ducc$ ./a.out
(0.362978,0.601326) (0.362155,0.18782) (0.380433,0.228703) (1.26662,0.327246)
(-1.0024,1.03302) 

My gcc version is

martin@debian:~/codes/ducc$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/martin/codes/umaster/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/martin/codes/gccgit/configure --disable-bootstrap
--disable-multilib --prefix=/home/martin/codes/umaster
--enable-languages=c++,fortran --enable-target=all --enable-checking=release
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20210103 (experimental) [master revision
37d0bb1f5b5:d78f978936b:3335c9f954f8939403eabb5ad3d8739be9984f81] (GCC) 

I have tried to narrow down this failure further, but without success so far.
It's quite possible that the mistake is on my side, but using the sanitizers
and valgrind I have not been able to find anything.

Maybe a git bisect could locate the commit that introduced the change in
behaviour.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-06  7:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 17:01 [Bug tree-optimization/98516] New: Wrong code generated by tree vectorizer martin@mpa-garching.mpg.de
2021-01-04 18:59 ` [Bug tree-optimization/98516] " martin@mpa-garching.mpg.de
2021-01-05 10:30 ` [Bug tree-optimization/98516] [11 Regression] Wrong code generated by tree vectorizer since r11-3823-g126ed72b9f48f853 marxin at gcc dot gnu.org
2021-01-05 10:37 ` marxin at gcc dot gnu.org
2021-01-05 11:28 ` rguenth at gcc dot gnu.org
2021-01-05 14:33 ` rguenth at gcc dot gnu.org
2021-01-05 14:41 ` rguenth at gcc dot gnu.org
2021-01-05 16:41 ` cvs-commit at gcc dot gnu.org
2021-01-05 16:41 ` rguenth at gcc dot gnu.org
2021-01-05 18:06 ` martin@mpa-garching.mpg.de
2021-01-06  7:41 ` rguenther at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).