public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "remi.coulom at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105469] New: "execution reached an unreachable program point" with -flto Date: Tue, 03 May 2022 19:58:19 +0000 [thread overview] Message-ID: <bug-105469-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105469 Bug ID: 105469 Summary: "execution reached an unreachable program point" with -flto Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: remi.coulom at gmail dot com Target Milestone: --- Created attachment 52926 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52926&action=edit compressed preprocessed source file that produces the bug Operating system and compiler versions: Ubuntu 20.04: tested with g++ version 7.5.0, 8.4.0, 9.4.0, 10.3.0, 11.1.0, and 13.0 (compiled from git repository this week-end with default options). Also in 32-bit cygwin with 11.2.0. All produce the same problem. Step to reproduce the problem: The program works well when compiling without -flto: $ g++ -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -O3 -fsanitize=unreachable -o repro repro.ii $ ./repro -> Yeah, no bug! adding -flto makes it crash: $ g++ -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -O3 -flto -fsanitize=unreachable -o repro repro.ii $ ./repro -> repro.cpp:1345:24: runtime error: execution reached an unreachable program point I added some trace to the code, that shows a little more information. I tried to reduce the size of the code as much pas possible, but it was very difficult because many changes can make the problem appear or disappear. In particular, not catching exceptions in main makes the bug disappear. I searched the web for this error message, and found this interesting link: https://deathandthepenguinblog.wordpress.com/2021/02/13/undefined-behaviour-and-nasal-demons-or-do-not-meddle-in-the-affairs-of-optimizers/ What is described there feels similar to what is happening to me. So I searched hard for undefined behaviour in my code. I humbly admit that this crash may very well be a bug in my code instead of a bug in g++, but after several days of struggle, I still really can make no sense of what is happening. If g++ detected undefined behavior in my code and is using this to remove some part of the code or perform optimizations, then I feel it should tell me. I want to know, because undefined behavior is much more likely to be a bug that needs fixing rather than a good optimization opportunity.
next reply other threads:[~2022-05-03 19:58 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-03 19:58 remi.coulom at gmail dot com [this message] 2022-05-04 6:28 ` [Bug middle-end/105469] " rguenth at gcc dot gnu.org 2022-05-04 7:15 ` remi.coulom at gmail dot com 2022-05-04 8:54 ` marxin at gcc dot gnu.org 2022-05-04 9:28 ` jakub at gcc dot gnu.org 2022-05-04 10:30 ` marxin at gcc dot gnu.org 2022-05-04 10:33 ` marxin at gcc dot gnu.org 2022-05-04 10:34 ` marxin at gcc dot gnu.org 2022-05-04 10:44 ` rguenth at gcc dot gnu.org 2022-05-04 10:50 ` marxin at gcc dot gnu.org 2022-05-04 10:53 ` marxin at gcc dot gnu.org 2022-05-04 11:01 ` [Bug middle-end/105469] "execution reached an unreachable program point" with -flto since r5-7027-g0b986c6ac777aa4e marxin at gcc dot gnu.org 2022-05-04 11:01 ` jakub at gcc dot gnu.org 2022-05-05 4:50 ` pinskia at gcc dot gnu.org 2022-05-11 12:47 ` remi.coulom at gmail dot com 2022-09-14 13:08 ` [Bug middle-end/105469] [10/11/12/13 Regression] " rguenth at gcc dot gnu.org 2023-01-18 16:46 ` jakub at gcc dot gnu.org 2023-01-18 16:47 ` jakub at gcc dot gnu.org 2023-01-18 21:30 ` hubicka at gcc dot gnu.org 2023-01-19 13:25 ` jamborm at gcc dot gnu.org 2023-07-07 10:43 ` [Bug middle-end/105469] [11/12/13/14 " rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105469-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).