public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/110731] New: [11/12/13/14 Regression] Wrong-code because of wide-int division since r5-424
Date: Wed, 19 Jul 2023 07:18:50 +0000	[thread overview]
Message-ID: <bug-110731-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 110731
           Summary: [11/12/13/14 Regression] Wrong-code because of
                    wide-int division since r5-424
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r5-424-g807e902eea17f313 (merge of wide-int) we miscompile following
testcase
(noticed it first with _BitInt(119)):

__int128
foo (void)
{
  struct S { __int128 f : 119; } s = { ((__int128) -18014398509481984) << 64 };
  return s.f / 2;
}

int
main ()
{
  if (foo () != (((__int128) -9007199254740992) << 64))
    __builtin_abort ();
}

The result of dividing (-332306998946228968225951765070086143wb - 1) by 2 is
-166153499473114484112975882535043072wb but we return
166153499473114484112975882535043072wb instead (in hex that is
0, 0xffc0000000000000 signed 119 pair divided by 2 resulting in
0, 0x0020000000000000 signed 119 pair rather than
0, 0xffe0000000000000.

             reply	other threads:[~2023-07-19  7:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  7:18 jakub at gcc dot gnu.org [this message]
2023-07-19  7:19 ` [Bug tree-optimization/110731] " jakub at gcc dot gnu.org
2023-07-19  7:39 ` pinskia at gcc dot gnu.org
2023-07-19  7:56 ` jakub at gcc dot gnu.org
2023-07-19 11:50 ` cvs-commit at gcc dot gnu.org
2023-07-19 12:24 ` cvs-commit at gcc dot gnu.org
2023-07-19 17:56 ` [Bug tree-optimization/110731] [11/12 " jakub at gcc dot gnu.org
2023-12-16  0:37 ` cvs-commit at gcc dot gnu.org
2023-12-17 13:55 ` cvs-commit at gcc dot gnu.org
2024-06-12 11:58 ` 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-110731-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: 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).