public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97185] inconsistent builtin elimination for impossible range Date: Tue, 14 Jun 2022 17:37:09 +0000 [thread overview] Message-ID: <bug-97185-4-3wvKfetVc8@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-97185-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185 --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- There's a heuristic for ranges of allocation sizes to exclude zero (size_range_flags) that comes into play here. The actual range isn't "impossible" in the sense it's necessarily invalid. It just means the string function call is either a no-op or out of bounds, and so can be eliminated as an optimization. With the optimization consistently implemented the warning will also go away (eliminating the calls will prevent sanitizers from detecting the out of bounds ones, so that might be a consideration). In general, a low > high range denoted an anti-range before Ranger was introduced (i.e., ~[high, low]). With Ranger it's the corresponding union of two ranges. Some of the cruft for dealing with anti-ranges is still around, such as in get_size_range() in pointer-query.cc. The code should be migrated to the irange class and the representation probably also updated to print something more sensible (e.g., the union [MIN, high) U (low, MAX]; we talked about introducing a pretty-printer % directive for ranges to make the format consistent across all diagnostics).
next prev parent reply other threads:[~2022-06-14 17:37 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-23 20:18 [Bug tree-optimization/97185] New: " msebor at gcc dot gnu.org 2022-06-14 8:24 ` [Bug tree-optimization/97185] " siddhesh at gcc dot gnu.org 2022-06-14 17:37 ` msebor at gcc dot gnu.org [this message] 2022-06-15 8:32 ` siddhesh 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-97185-4-3wvKfetVc8@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).