public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ian at abbott dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/102810] New: Bogus Wstringop-overread warning when special (integer) pointer values passed to array parameter of a function Date: Mon, 18 Oct 2021 10:30:50 +0000 [thread overview] Message-ID: <bug-102810-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102810 Bug ID: 102810 Summary: Bogus Wstringop-overread warning when special (integer) pointer values passed to array parameter of a function Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ian at abbott dot org Target Milestone: --- I don't know why this code produces a Wstringop-overread warning since it has nothing to do with string operations. Also, why is there a warning for argument 2, but not for argument 1? extern int foo(const int *a, const int b[]); #define SPECIAL ((int *)2) int main(void) { foo(SPECIAL, SPECIAL); } int foo(const int a[], const int b[]) { return 0; } <source>: In function 'main': <source>:7:5: warning: 'foo' reading 4 bytes from a region of size 0 [-Wstringop-overread] 7 | foo(SPECIAL, SPECIAL); | ^~~~~~~~~~~~~~~~~~~~~ <source>:7:5: note: referencing argument 2 of type 'const int *' <source>:10:5: note: in a call to function 'foo' 10 | int foo(const int a[], const int b[]) | ^~~
next reply other threads:[~2021-10-18 10:30 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-18 10:30 ian at abbott dot org [this message] 2021-10-18 15:52 ` [Bug middle-end/102810] [11/12 Regression] Bogus Wstringop-overread passing a smaller array to an array parameter without a bound msebor at gcc dot gnu.org 2021-10-22 21:44 ` pinskia at gcc dot gnu.org 2022-01-19 7:55 ` rguenth at gcc dot gnu.org 2022-04-21 7:50 ` rguenth at gcc dot gnu.org 2023-05-29 10:05 ` [Bug middle-end/102810] [11/12/13/14 " 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-102810-4@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).