public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/109187] [13 Regression] ICE: qsort checking failed: qsort comparator non-negative on sorted output: 1736258160 at -O2 since r13-5154-g733a1b777f16cd Date: Mon, 20 Mar 2023 16:15:28 +0000 [thread overview] Message-ID: <bug-109187-4-1QIqmeS9AW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109187-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109187 --- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> --- This is caused by overflowing subtraction in autopref_rank_for_schedule: if (!irrel1 && !irrel2) /* Sort memory references from lowest offset to the largest. */ r = data1->offset - data2->offset; When offsets are arbitrary this pattern (anti-pattern?) is inappropriate for producing a less/equal/greater comparison result. The following (or variants) is safe: diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc index 4efaa9445..11bf10645 100644 --- a/gcc/haifa-sched.cc +++ b/gcc/haifa-sched.cc @@ -5686,7 +5686,7 @@ autopref_rank_for_schedule (const rtx_insn *insn1, const rtx_insn *insn2) if (!irrel1 && !irrel2) /* Sort memory references from lowest offset to the largest. */ - r = data1->offset - data2->offset; + r = (data1->offset > data2->offset) - (data1->offset < data2->offset); else if (write) /* Schedule "irrelevant" insns before memory stores to resolve as many producer dependencies of stores as possible. */
next prev parent reply other threads:[~2023-03-20 16:15 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-19 5:45 [Bug rtl-optimization/109187] New: [13 Regression] ICE: qsort checking failed: qsort comparator non-negative on sorted output: 1736258160 at -O2 zsojka at seznam dot cz 2023-03-19 23:12 ` [Bug rtl-optimization/109187] " pinskia at gcc dot gnu.org 2023-03-20 13:50 ` [Bug rtl-optimization/109187] [13 Regression] ICE: qsort checking failed: qsort comparator non-negative on sorted output: 1736258160 at -O2 since r13-5154-g733a1b777f16cd marxin at gcc dot gnu.org 2023-03-20 16:15 ` amonakov at gcc dot gnu.org [this message] 2023-03-22 13:15 ` amonakov at gcc dot gnu.org 2023-03-27 7:45 ` rguenth at gcc dot gnu.org 2023-03-28 13:44 ` cvs-commit at gcc dot gnu.org 2023-03-28 13:46 ` amonakov 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-109187-4-1QIqmeS9AW@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).