public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/113226] [14 Regression] testsuite/std/ranges/iota/max_size_type.cc fails for cris-elf after r14-6888-ga138b99646a555
Date: Thu, 04 Jan 2024 16:58:00 +0000	[thread overview]
Message-ID: <bug-113226-4-migWcKHvBq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113226-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #1)
> Huh, how bizarre.
> 
> > i == 1, j == -100, i*j == 4294967196, max_type(i) == 1, max_type(i)*j == -100
> 
> Here i and j are just ordinary 'long long', so I don't get why i*j is
> 4294967196 instead of -100?

Everything else, in particular that int64_t(max_type(i)*j) is -100, seems
correct/expected to me.  FWIW that expression computes the product of the
corresponding promoted/sign-extended 65-bit precision values, and the overall
check is analogous to

  int32_t i = 1, j = -100;
  assert (int64_t(i*j) == int64_t(i)*j);

except the two precisions are 64/65 bits instead of 32/64 bits.

(When shorten_p is true, the overall check is analogous to
 assert (i*j == int32_t(int64_t(i)*j)) instead.)

  parent reply	other threads:[~2024-01-04 16:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04  0:59 [Bug testsuite/113226] New: " hp at gcc dot gnu.org
2024-01-04 16:08 ` [Bug testsuite/113226] " ppalka at gcc dot gnu.org
2024-01-04 16:58 ` ppalka at gcc dot gnu.org [this message]
2024-01-04 17:57 ` hp at gcc dot gnu.org
2024-01-08 14:44 ` rguenth at gcc dot gnu.org
2024-01-08 22:13 ` [Bug target/113226] " hp at gcc dot gnu.org
2024-03-04  4:19 ` law at gcc dot gnu.org
2024-05-07  7:43 ` [Bug target/113226] [14/15 " 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-113226-4-migWcKHvBq@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).