public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106904] [12/13 Regression] Incorrect -Wstringop-overflow with partial memcpy() into a nested structure
Date: Sun, 11 Dec 2022 13:35:19 +0000	[thread overview]
Message-ID: <bug-106904-4-b6QXuGE8td@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106904-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106904

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:f8d136e50e6f82cba793483d910a2b2643108508

commit r13-4598-gf8d136e50e6f82cba793483d910a2b2643108508
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Dec 7 14:42:24 2022 +0100

    tree-optimization/106904 - bogus -Wstringopt-overflow with vectors

    The following avoids CSE of &ps->wp to &ps->wp.hwnd confusing
    -Wstringopt-overflow by making sure to produce addresses to the
    biggest container from vectorization.  For this I introduce
    strip_zero_offset_components which turns &ps->wp.hwnd into
    &(*ps) and use that to base the vector data references on.
    That will also work for addresses with variable components,
    alternatively emitting pointer arithmetic via calling
    get_inner_reference and gimplifying that would be possible
    but likely more intrusive.

    This is by no means a complete fix for all of those issues
    (avoiding ADDR_EXPRs in favor of pointer arithmetic might be).
    Other passes will have similar issues.

    In theory that might now cause false negatives.

            PR tree-optimization/106904
            * tree.h (strip_zero_offset_components): Declare.
            * tree.cc (strip_zero_offset_components): Define.
            * tree-vect-data-refs.cc (vect_create_addr_base_for_vector_ref):
            Strip zero offset components before building the address.

            * gcc.dg/Wstringop-overflow-pr106904.c: New testcase.

  parent reply	other threads:[~2022-12-11 13:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11 22:47 [Bug c/106904] New: " zfigura at codeweavers dot com
2022-09-11 22:51 ` [Bug tree-optimization/106904] " pinskia at gcc dot gnu.org
2022-09-11 22:52 ` zfigura at codeweavers dot com
2022-09-11 22:54 ` zfigura at codeweavers dot com
2022-09-13 15:30 ` [Bug tree-optimization/106904] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-12-07 13:42 ` rguenth at gcc dot gnu.org
2022-12-11 13:35 ` cvs-commit at gcc dot gnu.org [this message]
2022-12-11 13:35 ` [Bug tree-optimization/106904] [12 " rguenth at gcc dot gnu.org
2022-12-11 17:40 ` zfigura at codeweavers dot com
2023-03-15  9:47 ` cvs-commit at gcc dot gnu.org
2023-03-15 10:05 ` 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-106904-4-b6QXuGE8td@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: link
Be 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).