public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "stilor at att dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111696] New: [11/12/13/14 Regression] Spurious -Wstringop-overflow Date: Wed, 04 Oct 2023 18:03:29 +0000 [thread overview] Message-ID: <bug-111696-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111696 Bug ID: 111696 Summary: [11/12/13/14 Regression] Spurious -Wstringop-overflow Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: stilor at att dot net Target Milestone: --- Created attachment 56052 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56052&action=edit test case The attached testcase started producing a warning beginning with commit 8d57bdadd2d9c2e5c95515ca7a583d7b407b55c4 when compiled with `-O3` (or `-O2 -ftree-slp-vectorize`). Starting with commit 2b8453c401b699ed93c085d0413ab4b5030bcdb8, vectorization is also enabled at `-O2` and the testcase starting failing at `-O2` as well. The warning can be reproduced at current HEAD (96557ee6a0a234821af865800d22621efa6e7390) as well. Failure message: $ /usr/gcc-test/bin/gcc -c -O3 -Wall -Werror stringop-overflow-bug-gcc.c stringop-overflow-bug-gcc.c: In function ‘update’: stringop-overflow-bug-gcc.c:25:3: error: writing 24 bytes into a region of size 16 [-Werror=stringop-overflow=] 25 | memcpy(&last->s, &cur.s, sizeof(struct nested)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stringop-overflow-bug-gcc.c:10:17: note: destination object ‘a’ of size 16 10 | unsigned long a[2]; | ^ cc1: all warnings being treated as errors $ /usr/gcc-test/bin/gcc -v Using built-in specs. COLLECT_GCC=/usr/gcc-test/bin/gcc COLLECT_LTO_WRAPPER=/usr/gcc-test/libexec/gcc/x86_64-pc-linux-gnu/11.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --enable-languages=c --prefix=/usr/gcc-test --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.0.1 20210303 (experimental) (GCC) The message is bogus: - the "note" points to a member inside a structure and references that member's size while memcpy has the whole structure as a destination. - commenting out any of the first two statements in the update() function removes the warning even though it has no effect on the addresses passed to memcpy().
next reply other threads:[~2023-10-04 18:03 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-04 18:03 stilor at att dot net [this message] 2023-10-04 22:50 ` [Bug middle-end/111696] " pinskia at gcc dot gnu.org 2023-10-04 22:55 ` pinskia at gcc dot gnu.org 2023-10-05 7:38 ` rguenth at gcc dot gnu.org 2024-03-07 21:06 ` law 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-111696-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).