public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/105918] [12/13 Regression] Spurious Warray-bounds in std::to_chars since r12-2132-ga110855667782dac
Date: Tue, 29 Nov 2022 18:14:20 +0000 [thread overview]
Message-ID: <bug-105918-4-l0vplxaNep@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105918-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105918
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Shorter testcase (still need to reduce it futher):
> #include <charconv>
> void toChars(int number) {
> char temp[1];
> std::to_chars(temp, temp + 1, number);
> }
So the failure mode is std::to_chars treating a negative 'number' specially,
in this case starting from the end. We get
<bb 6> [local count: 536870912]:
# __first_9 = PHI <&temp(4), &MEM <char[1]> [(void *)&temp + 1B](5)>
# __unsigned_val_10 = PHI <__unsigned_val_5(4), __unsigned_val_8(5)>
and
<bb 21> [local count: 241591910]:
__num_47 = __val_28 * 2;
_48 = __num_47 + 1;
_49 = __digits[_48];
MEM[(char *)__first_9 + 1B] = _49;
_50 = __digits[__num_47];
*__first_9 = _50;
here the __first_9 + 1 store is _always_ out of bounds. It might be
that this block is never reachable but we couldn't prove that.
next prev parent reply other threads:[~2022-11-29 18:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 14:01 [Bug c++/105918] New: Spurious Warray-bounds in std::to_chars ed at catmur dot uk
2022-06-21 5:48 ` [Bug tree-optimization/105918] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-07-08 12:34 ` [Bug tree-optimization/105918] [12/13 Regression] Spurious Warray-bounds in std::to_chars since r12-2132-ga110855667782dac marxin at gcc dot gnu.org
2022-07-25 16:03 ` rguenth at gcc dot gnu.org
2022-11-29 18:14 ` rguenth at gcc dot gnu.org [this message]
2023-05-08 12:24 ` [Bug tree-optimization/105918] [12/13/14 " 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-105918-4-l0vplxaNep@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).