public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106568] New: -freorder-blocks-algorithm appears to causes a crash in stable code, no way to disable it
@ 2022-08-08 21:20 noloader at gmail dot com
  2022-08-08 21:30 ` [Bug middle-end/106568] " ktkachov at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: noloader at gmail dot com @ 2022-08-08 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106568
           Summary: -freorder-blocks-algorithm appears to causes a crash
                    in stable code, no way to disable it
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: noloader at gmail dot com
  Target Milestone: ---

Hi Everyone,

This is going to be a shitty bug report because we don't have a reproducer. We
believe we have it narrowed down to a particular optimization, however.

Debian Unstable, Fedora 37 and Gentoo 17.1 are reporting crashes in Crypto++
test program.[1,2] The distros use GCC 12. We found a particular function
crashes without explanation (and a garbage backtrace) at -O2 and -O3. The
function is Ok at -O0, -O1 and -Os.

(The code has been fairly stable for years. It is -Wall, -Wextra, Asan, UBsan
and Valgrind clean. We would be surprised to learn we have undetected UB. But
we don't rule it out).

According to GCC Optimization docs, the difference between -Os (no crash) and
-O2 (crash) are:[3]

    -falign-functions
    -falign-jumps
    -falign-labels
    -falign-loops
    -fprefetch-loop-arrays
    -freorder-blocks-algorithm=stc

We used CFLAGS and CXXFLAGS with -Os plus listed opts less
-freorder-blocks-algorithm=stc. The crash went away.

We are fairly certain the problem is with the -freorder-blocks-algorithm
optimization. The problem we are now having is, we don't know how to disable
it. The following fails to compile:

    -fno-reorder-blocks-algorithm
    -freorder-blocks-algorithm=none
    -freorder-blocks-algorithm=

So, we believe we have a bad option in -freorder-blocks-algorithm, but we can't
disable it for typical opt settings used by distros. The typical opt setting is
-O2 or -O3.

I sincerely apologize for not having a reproducer. I'm not sure where to begin
when it comes to -freorder-blocks-algorithm.

Please advise.

[1] https://github.com/weidai11/cryptopp/issues/1134
[2] https://github.com/weidai11/cryptopp/issues/1141
[3] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

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

end of thread, other threads:[~2024-02-06 22:21 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 21:20 [Bug c++/106568] New: -freorder-blocks-algorithm appears to causes a crash in stable code, no way to disable it noloader at gmail dot com
2022-08-08 21:30 ` [Bug middle-end/106568] " ktkachov at gcc dot gnu.org
2022-08-08 21:34 ` pinskia at gcc dot gnu.org
2022-08-08 21:36 ` [Bug rtl-optimization/106568] " pinskia at gcc dot gnu.org
2022-08-08 21:40 ` pinskia at gcc dot gnu.org
2022-08-08 21:52 ` noloader at gmail dot com
2022-08-08 22:00 ` pinskia at gcc dot gnu.org
2022-08-08 22:18 ` noloader at gmail dot com
2022-08-08 22:25 ` pinskia at gcc dot gnu.org
2022-08-08 23:05 ` noloader at gmail dot com
2022-08-08 23:20 ` noloader at gmail dot com
2022-08-08 23:22 ` pinskia at gcc dot gnu.org
2022-08-08 23:23 ` pinskia at gcc dot gnu.org
2022-08-09  0:56 ` noloader at gmail dot com
2022-08-09  1:09 ` noloader at gmail dot com
2022-08-09  1:35 ` noloader at gmail dot com
2022-08-09  1:45 ` pinskia at gcc dot gnu.org
2022-08-09  1:46 ` pinskia at gcc dot gnu.org
2022-08-09  2:05 ` noloader at gmail dot com
2022-08-09  4:22 ` noloader at gmail dot com
2022-08-09  4:22 ` noloader at gmail dot com
2022-08-09  7:57 ` rguenth at gcc dot gnu.org
2024-02-06 20:20 ` redi at gcc dot gnu.org
2024-02-06 20:28 ` pinskia at gcc dot gnu.org
2024-02-06 21:50 ` pinskia at gcc dot gnu.org
2024-02-06 22:21 ` [Bug ipa/106568] " pinskia at gcc dot gnu.org

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).