[Bug tree-optimization/126375] [14/15/16/17 Regression] wrong code at -O2

souradiptodas6 at gmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126375

Souradipto Das <souradiptodas6 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |souradiptodas6 at gmail dot com

--- Comment #2 from Souradipto Das <souradiptodas6 at gmail dot com> ---
I bisected the error to the following commit:

commit 936a12331a2bd95e9003221e292719b7ffcf07d0
Author: Jan Hubicka <[email protected]>
Date:   Wed Aug 23 11:17:20 2023 +0200
    Fix handling of static exists in loop_ch

Additional findings:
* Compiling with `-O2 -fno-tree-ch` avoids the bug.
* Compiling with `-O2 -fno-thread-jumps` ALSO avoids the bug and restores
correct runtime behavior. 

This indicates that the aggressive zero-cost block duplication introduced to
`loop_ch` in this commit is altering the CFG in a way that exposes a downstream
miscompilation in the jump threading pass.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.