public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andre Simoes Dias Vieira <avieira@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-3547] vect: Reject non-byte offsets for gather/scatters [PR107346]
Date: Fri, 28 Oct 2022 14:09:05 +0000 (GMT)	[thread overview]
Message-ID: <20221028140907.88A53385D0C0@sourceware.org> (raw)

https://gcc.gnu.org/g:95decac3ce8c8c7c5302cd6fac005a10463de165

commit r13-3547-g95decac3ce8c8c7c5302cd6fac005a10463de165
Author: Andre Vieira <andre.simoesdiasvieira@arm.com>
Date:   Fri Oct 28 15:05:11 2022 +0100

    vect: Reject non-byte offsets for gather/scatters [PR107346]
    
    The ada failure reported in the PR was being caused by vect_check_gather_scatter
    failing to deal with bit offsets that weren't multiples of BITS_PER_UNIT. This
    patch makes vect_check_gather_scatter reject memory accesses with such offsets.
    
    gcc/ChangeLog:
    
            PR tree-optimization/107346
            * tree-vect-data-refs.cc (vect_check_gather_scatter): Reject offsets
            that aren't multiples of BITS_PER_UNIT.

Diff:
---
 gcc/tree-vect-data-refs.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index 4a23d6172aa..6c892791bd4 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -4016,6 +4016,11 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
   if (reversep)
     return false;
 
+  /* PR 107346.  Packed structs can have fields at offsets that are not
+     multiples of BITS_PER_UNIT.  Do not use gather/scatters in such cases.  */
+  if (!multiple_p (pbitpos, BITS_PER_UNIT))
+    return false;
+
   poly_int64 pbytepos = exact_div (pbitpos, BITS_PER_UNIT);
 
   if (TREE_CODE (base) == MEM_REF)

                 reply	other threads:[~2022-10-28 14:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221028140907.88A53385D0C0@sourceware.org \
    --to=avieira@gcc.gnu.org \
    --cc=gcc-cvs@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).