public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "andy.koppe at analog dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/102711] New: Infinite loop with extern calls removed with -O2 or higher Date: Tue, 12 Oct 2021 15:47:40 +0000 [thread overview] Message-ID: <bug-102711-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102711 Bug ID: 102711 Summary: Infinite loop with extern calls removed with -O2 or higher Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: andy.koppe at analog dot com Target Milestone: --- Created attachment 51591 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51591&action=edit Minimized example Compiling the minimised example below (and attached) with -O2 or higher, if FAIL is defined, the second infinite loop is removed. Code is produced for it when FAIL is not defined. Reproduced with gcc 10.3.1 for aarch64-none-elf, gcc 11.2.0 for x86_64-pc-cygwin, and gcc 9.3.0 for x86_64-linux-gnu. $ cat test.c int bar(void); void foo(void) { if (!bar()) for (;;); for (;;) { static int flag = 0; int ret = 0; bar(); if (flag) { ret = bar(); if (!ret) ret = bar(); } flag = !bar(); #ifdef FAIL if (!ret) #endif bar(); } } $ aarch64-none-elf-gcc -O2 -S test.c -DFAIL $ cat test.s .arch armv8-a .file "test.c" .text .align 2 .p2align 4,,11 .global foo .type foo, %function foo: stp x29, x30, [sp, -16]! mov x29, sp bl bar .L2: b .L2 .size foo, .-foo .ident "GCC: (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 10.3.1 20210621"
next reply other threads:[~2021-10-12 15:47 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-12 15:47 andy.koppe at analog dot com [this message] 2021-10-12 16:03 ` [Bug tree-optimization/102711] [9/10/11 Regression] CDDCE removes condition that might lead to an infinite loop causing an unconditional infinite loop pinskia at gcc dot gnu.org 2021-10-12 16:08 ` pinskia at gcc dot gnu.org 2021-10-13 6:44 ` rguenth at gcc dot gnu.org 2021-10-13 12:10 ` marxin at gcc dot gnu.org 2021-10-13 12:14 ` rguenther at suse dot de 2021-11-10 14:32 ` marxin at gcc dot gnu.org 2022-05-27 9:46 ` [Bug tree-optimization/102711] [10/11 " rguenth at gcc dot gnu.org 2022-06-28 10:46 ` jakub at gcc dot gnu.org 2023-07-07 10:41 ` [Bug tree-optimization/102711] [11 " 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-102711-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).