public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sebastien.michelland@ens-lyon.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/106609] [SH] miscompilation due to incorrect elimination of comparisons to 0
Date: Tue, 16 Aug 2022 21:03:59 +0000 [thread overview]
Message-ID: <bug-106609-4-8ajXLYvJZx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106609-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106609
--- Comment #5 from Sébastien Michelland <sebastien.michelland@ens-lyon.fr> ---
> Then this is a target specific issue until provided otherwise. mach stands for machine (target) specific pass.
That makes a lot of sense, thanks.
I found a much simpler example exhibiting the bug:
int f(int i, int j)
{
if(i < 0) return 1;
if(i + j) return 3;
return i;
}
Latest HEAD with -O1 (same setup as before) compiles it to
_f: cmp/pz r4
bf .L3
bf .L4
rts
mov r4,r0
.L3: rts
mov #1,r0
.L4: rts
mov #3,r0
incorrectly eliminating the test for (i + j) != 0. The label .L4 returning 3 is
evidently unreachable.
Comparing to 0 seems to be required. My previous example also compiles
correctly if we check values[i] != 1 instead, which invalidates the loop/CFG
theory.
Few commits changed the SH subtree since GCC 11.1.0; I should be able to bisect
it. In the meantime I've updated the title.
next prev parent reply other threads:[~2022-08-16 21:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-13 17:31 [Bug c/106609] New: [SH] miscompilation of loop involving noreturn call sebastien.michelland@ens-lyon.fr
2022-08-15 8:28 ` [Bug middle-end/106609] " rguenth at gcc dot gnu.org
2022-08-15 9:47 ` sebastien.michelland@ens-lyon.fr
2022-08-15 15:52 ` [Bug target/106609] " pinskia at gcc dot gnu.org
2022-08-16 21:03 ` [Bug target/106609] [SH] miscompilation due to incorrect elimination of comparisons to 0 sebastien.michelland@ens-lyon.fr
2022-08-16 21:03 ` sebastien.michelland@ens-lyon.fr [this message]
2022-08-17 8:09 ` sebastien.michelland@ens-lyon.fr
2022-11-24 13:13 ` [Bug target/106609] [12/13 Regression] sh3eb-elf cross compiler is being miscompiled since r12-1525-g3155d51bfd1de8b6c4645 jakub at gcc dot gnu.org
2022-11-24 14:38 ` [Bug target/106609] [12 " jakub at gcc dot gnu.org
2022-11-24 17:04 ` sebastien.michelland@ens-lyon.fr
2023-02-28 23:08 ` sam at gentoo dot org
2023-05-08 12:25 ` 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-106609-4-8ajXLYvJZx@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: link
Be 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).