public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix PR68517
Date: Wed, 25 Nov 2015 09:39:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.11.1511251020290.4884@t29.fhfr.qr> (raw)


Committed as obvious.

Richard.

2015-11-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68517
	* tree-vect-data-refs.c (vect_analyze_data_ref_accesses):
	Properly handle zero-sized types.

	* gcc.dg/torture/pr68517.c: New testcase.

Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	(revision 230856)
+++ gcc/tree-vect-data-refs.c	(working copy)
@@ -2769,7 +2769,8 @@ vect_analyze_data_ref_accesses (vec_info
 	  /* If init_b == init_a + the size of the type * k, we have an
 	     interleaving, and DRA is accessed before DRB.  */
 	  HOST_WIDE_INT type_size_a = tree_to_uhwi (sza);
-	  if ((init_b - init_a) % type_size_a != 0)
+	  if (type_size_a == 0
+	      || (init_b - init_a) % type_size_a != 0)
 	    break;
 
 	  /* If we have a store, the accesses are adjacent.  This splits
Index: gcc/testsuite/gcc.dg/torture/pr68517.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr68517.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr68517.c	(working copy)
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+typedef struct
+{
+} st1;
+
+typedef struct
+{
+  volatile int c;
+} __attribute__ ((aligned (4))) st2;
+
+struct s4
+{
+  st1 f1;
+  st2 f2;
+  st1 f3;
+};
+
+struct s3;
+
+void
+foo (struct s3 *arg, struct s4 *arg1)
+{
+  arg1->f1 = (st1) { };
+  arg1->f3 = (st1) { };
+}

                 reply	other threads:[~2015-11-25  9:21 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=alpine.LSU.2.11.1511251020290.4884@t29.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@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).