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 analyzer/114472] [14 Regression] ICE: in falls_short_of_p, at analyzer/store.cc:365 (in exceeds_p, at analyzer/store.cc:342) with -fanalyzer Date: Tue, 09 Apr 2024 11:41:36 +0000 [thread overview] Message-ID: <bug-114472-4-5tdwm9clbu@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114472-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114472 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- strncpy (..., -1) is an always UB case; the testcase has UB already on &s - 3, but get_next_bit_offset of -32 suggests that it is somehow adding the -3 * BITS_PER_UNIT offset from the source and the -1 * BITS_PER_UNIT from the size. That is wrong, first of all, strncpy from the source copies just at most that many bytes, in a valid program there would need to be a '\0' far before that as one can't do pointer arithmetics in char * past half of the address space; plus the size isn't negative, it is positive 0xffffffffffffffffULL on x86-64. The reason strncpy would be UB with [LONG_MAX + 1UL, ULONG_MAX] last argument is that it then has to fill the rest of the buffer with '\0's and again the pointer arithmetics isn't well defined in that case.
next prev parent reply other threads:[~2024-04-09 11:41 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-25 18:25 [Bug analyzer/114472] New: " zsojka at seznam dot cz 2024-03-25 18:47 ` [Bug analyzer/114472] " dmalcolm at gcc dot gnu.org 2024-03-26 8:06 ` rguenth at gcc dot gnu.org 2024-04-09 11:41 ` jakub at gcc dot gnu.org [this message] 2024-04-09 20:06 ` dmalcolm at gcc dot gnu.org 2024-04-10 20:47 ` cvs-commit at gcc dot gnu.org 2024-04-10 21:00 ` dmalcolm 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-114472-4-5tdwm9clbu@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).