From patchwork Wed Nov 25 09:20:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 548450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 74E191402D9 for ; Wed, 25 Nov 2015 20:21:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=o2tAuO81; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=DjrwWUi/pdOVlOfns4eSFa9OGimhxJrGxj9xG8EEVPvaDTGBwY7L6 b2yKJcoK8g7bitctBm9Lr09I73HPnQ8zcEaX3wqgnASEC2hWDTxwPkDHpMSS0TMp 2yqNclBA8XneeaADQqH3W4e1aLl4xQXq0621rXBdieLckTsZM3Gm5o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=XWZHhMK5m4KZNLxdRj5WwQ7QREc=; b=o2tAuO81AQDh3Q/mJqiK KKvuPseQUN7HV7/6VdGxGa206YURyG7ku+8guItyeMkLHK88g3EyMFPTsqizwtVq OjuLBZWnp1dd3Ms3V1dlku6B88tu2z9h0uOC+Vtd/ZRO/XQZI6qTQcyUKzhQH1Yf NBzh4+tTNx644NCvTOJ01w0= Received: (qmail 105309 invoked by alias); 25 Nov 2015 09:21:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101606 invoked by uid 89); 25 Nov 2015 09:21:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 25 Nov 2015 09:21:01 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 053BFAAC4 for ; Wed, 25 Nov 2015 09:19:19 +0000 (UTC) Date: Wed, 25 Nov 2015 10:20:57 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR68517 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Committed as obvious. Richard. 2015-11-25 Richard Biener 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) { }; +}