From patchwork Tue Jan 5 18:25:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 563225 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 1BE271402EC for ; Wed, 6 Jan 2016 05:26:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=u0mLWCgL; 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:reply-to:mime-version:content-type; q=dns; s=default; b=NxqSYIqG2PFVPpUMxaBuBuRHoES6gRiLDOGLU3Iei98 nGc5iosMDc41BaYYKsNJh3UbMguFcaXEV88347yMkVv4bWdoYpNE41uzFLo1JfpP J/fRDXvpoWsPBv05+YT8FcFxLxOVrWWjZlnrKGYuamgCeuXGjH6Xyfegfi50RIcw = 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:reply-to:mime-version:content-type; s=default; bh=lT8BD9aHOCeLL8LzcdFGUJbwprc=; b=u0mLWCgLb6ChwYHiw weq8dY1znYo7NbuvkPW1H/Bez57afbzOKsJdfpZmYLbFbJkMWzoFK3CkjgLAqHvn Toei8YsY+4s5LvFAWz7y3WidtGUMicNHzk/IvGdYhScO+C4bAkG+7GcEKIfaNqtD muB2vioXUUL1qv/ljPNPcvu/mw= Received: (qmail 106715 invoked by alias); 5 Jan 2016 18:26:04 -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 106702 invoked by uid 89); 5 Jan 2016 18:26:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL, BAYES_20, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=openacc, preserve, DECL_ATTRIBUTES, decl_attributes X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 05 Jan 2016 18:26:03 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id D1EFCC0B7E0E for ; Tue, 5 Jan 2016 18:26:01 +0000 (UTC) Received: from tucnak.zalov.cz ([10.3.113.3]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u05IQ0L9008618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 5 Jan 2016 13:26:01 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u05IPwIO026002 for ; Tue, 5 Jan 2016 19:25:59 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u05IPvWH025833 for gcc-patches@gcc.gnu.org; Tue, 5 Jan 2016 19:25:57 +0100 Date: Tue, 5 Jan 2016 19:25:57 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Preserve user alignment on decls (PR middle-end/68960) Message-ID: <20160105182557.GA18720@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi! When a VAR_DECL is copied (e.g. for OpenMP/OpenACC privatization, or when moving SESE region to another function), copy_var_decl only preserves user alignment on types, but not on decls. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-01-05 Jakub Jelinek PR middle-end/68960 * gimple-expr.c (copy_var_decl): If var has DECL_USER_ALIGN set, copy it and DECL_ALIGN too. * testsuite/libgomp.c/pr68960.c: New test. Jakub --- gcc/gimple-expr.c.jj 2016-01-04 14:55:52.000000000 +0100 +++ gcc/gimple-expr.c 2016-01-05 16:21:53.831077722 +0100 @@ -375,6 +375,11 @@ copy_var_decl (tree var, tree name, tree TREE_USED (copy) = 1; DECL_SEEN_IN_BIND_EXPR_P (copy) = 1; DECL_ATTRIBUTES (copy) = DECL_ATTRIBUTES (var); + if (DECL_USER_ALIGN (var)) + { + DECL_ALIGN (copy) = DECL_ALIGN (var); + DECL_USER_ALIGN (copy) = 1; + } return copy; } --- libgomp/testsuite/libgomp.c/pr68960.c.jj 2016-01-05 16:26:34.957162544 +0100 +++ libgomp/testsuite/libgomp.c/pr68960.c 2016-01-05 16:30:11.000000000 +0100 @@ -0,0 +1,25 @@ +/* PR middle-end/68960 */ +/* { dg-do run } */ + +int +main () +{ + int temp[257] __attribute__ ((aligned (256))) = { 0 }; + #pragma omp parallel private (temp) num_threads (2) + { + int *p = &temp[0]; + asm volatile ("" : "+g" (p)); + if (((__UINTPTR_TYPE__) p) & 255) + __builtin_abort (); + } + #pragma omp parallel num_threads (2) + #pragma omp single + #pragma omp task firstprivate (temp) + { + int *p = &temp[0]; + asm volatile ("" : "+g" (p)); + if (((__UINTPTR_TYPE__) p) & 255) + __builtin_abort (); + } + return 0; +}