public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rverschelde at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104789] [12 Regression] New -Wstringop-overflow false positive since r12-5863-g9354a7d70caef1c9 Date: Mon, 07 Mar 2022 12:39:08 +0000 [thread overview] Message-ID: <bug-104789-4-X0CNQWOcst@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104789-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104789 --- Comment #6 from Rémi Verschelde <rverschelde at gmail dot com> --- Indeed if the warning was reworded to make it clear that it's a risk and not a certainty would solve this. Both the reduced test case and the original code are both risky: `components` is an `uint32_t` that is set to either 1 or 3, so in the context of that code `header_bytes` would never exceed 8. But if this was changed to anything higher than 3 then yes, there would be a buffer overflow. If this is what this warning aims to warn about (the risk of buffer overflow and not the certainty of one), then there's probably no false positive. Adding: ``` if (components > 3) { return 0; } ``` to the reduced testcase does prevent the warning. On the other hand, the same kind of check doesn't seem to solve the warning in the original Godot case, so you're right about the reduced testcase being too reduced. I'll dig further and see if I can make a better testcase, or understand why a check on `components` (or even `header_bytes > 7`) isn't sufficient in Godot.
next prev parent reply other threads:[~2022-03-07 12:39 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-04 16:26 [Bug tree-optimization/104789] New: " marxin at gcc dot gnu.org 2022-03-04 16:26 ` [Bug tree-optimization/104789] " marxin at gcc dot gnu.org 2022-03-04 16:27 ` marxin at gcc dot gnu.org 2022-03-04 19:54 ` pinskia at gcc dot gnu.org 2022-03-04 19:57 ` pinskia at gcc dot gnu.org 2022-03-07 11:05 ` rverschelde at gmail dot com 2022-03-07 12:05 ` pinskia at gcc dot gnu.org 2022-03-07 12:39 ` rverschelde at gmail dot com [this message] 2022-03-07 13:30 ` rverschelde at gmail dot com 2022-03-07 18:10 ` msebor at gcc dot gnu.org 2022-03-07 18:34 ` [Bug tree-optimization/104789] [12 Regression] -Wstringop-overflow false positive at -O3 for an unrolled loop msebor at gcc dot gnu.org 2022-03-09 9:45 ` rguenth at gcc dot gnu.org 2022-03-14 17:35 ` msebor at gcc dot gnu.org 2022-05-06 8:32 ` [Bug tree-optimization/104789] [12/13 " jakub at gcc dot gnu.org 2022-07-26 12:43 ` rguenth at gcc dot gnu.org 2023-05-08 12:24 ` [Bug tree-optimization/104789] [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-104789-4-X0CNQWOcst@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).