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/110603] [14 Regression] GCC, ICE: internal compiler error: in verify_range, at value-range.cc:1104 since r14-255
Date: Tue, 23 Jan 2024 11:16:39 +0000	[thread overview]
Message-ID: <bug-110603-4-l2N1Zw2P9c@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110603-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Aldy Hernandez from comment #4)
> Now the reason we're passing swapped endpoints seems to originate in
> get_range_strlen_dynamic().  It is setting a min of 2, courtesy of the
> nonzero characters in the memcpy:
> 
> memcpy(a, "12", sizeof("12") - 1);

Guess in a program without UB both the bounds are valid, a zero terminated
string in
char[2] array can't have strlen longer than 1 and when '1' and '2' characters
are memcpyed at the start of some buffer then the string length will be at
least 2.
But the program would invoke UB if this code is reached, so the question is how
to resolve it.
The old behavior of VRP/ranger with swapping the boundaries avoided the ICE but
wasn't
right, this case isn't that the string length will be in [1, 2] range, but that
the argument will never be a valid zero terminated string.
So, guess either we shouldn't set minlen or maxlen (whatever is found second)
if it violates the other bound, or check it after the fact and pick just one of
them or set the other to one of them.

  parent reply	other threads:[~2024-01-23 11:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-09 11:34 [Bug c/110603] New: GCC, ICE: internal compiler error: in verify_range, at value-range.cc:1104 141242068 at smail dot nju.edu.cn
2023-07-09 14:57 ` [Bug tree-optimization/110603] [14 Regression] " pinskia at gcc dot gnu.org
2023-07-10  6:36 ` rguenth at gcc dot gnu.org
2023-10-17 12:10 ` rguenth at gcc dot gnu.org
2024-01-02 20:39 ` doko at gcc dot gnu.org
2024-01-09 18:06 ` [Bug tree-optimization/110603] [14 Regression] GCC, ICE: internal compiler error: in verify_range, at value-range.cc:1104 since r14-255 jakub at gcc dot gnu.org
2024-01-10 10:31 ` aldyh at gcc dot gnu.org
2024-01-23 11:16 ` jakub at gcc dot gnu.org [this message]
2024-01-27 12:48 ` jakub at gcc dot gnu.org
2024-01-29  9:21 ` cvs-commit at gcc dot gnu.org
2024-01-29  9:30 ` jakub 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-110603-4-l2N1Zw2P9c@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).