From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23535 invoked by alias); 28 Oct 2015 19:29:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 23412 invoked by uid 89); 28 Oct 2015 19:29:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: smtp.ispras.ru Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.199.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Oct 2015 19:29:40 +0000 Received: from [10.10.3.121] (unknown [83.149.199.91]) by smtp.ispras.ru (Postfix) with ESMTP id 4196620515; Wed, 28 Oct 2015 22:29:38 +0300 (MSK) Date: Wed, 28 Oct 2015 19:37:00 -0000 From: Alexander Monakov To: Bernd Schmidt cc: gcc-patches@gcc.gnu.org, Jakub Jelinek , Dmitry Melnik Subject: Re: [gomp4 04/14] nvptx: fix output of _Bool global variables In-Reply-To: <56311014.9000502@redhat.com> Message-ID: References: <1445366076-16082-1-git-send-email-amonakov@ispras.ru> <1445366076-16082-5-git-send-email-amonakov@ispras.ru> <5626A898.5000703@redhat.com> <5630FE4D.8040803@redhat.com> <56310812.6090402@redhat.com> <56310D12.7040904@redhat.com> <56311014.9000502@redhat.com> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2015-10/txt/msg03103.txt.bz2 On Wed, 28 Oct 2015, Bernd Schmidt wrote: > On 10/28/2015 07:06 PM, Alexander Monakov wrote: > > On Wed, 28 Oct 2015, Bernd Schmidt wrote: > > > Ok, so adjust the if condition for non-integral types - make it false if > > > the > > > size of the struct is smaller than the pointer type. > > > > I'm afraid it's an insufficient fix: it would remain broken for size-12 > > structs (containing 3 int fields, for example): they would be emitted with > > size 16 instead. > > Maybe check TYPE_ or DECL_ALIGN as well then. But I think in general the > problem cannot be avoided, let's say if you have a size-12 struct with a > pointer field. Only packed structs might have their size indivisible by pointer size while containing a pointer field, so the problematic category is narrow. Packed structs aside, checking alignment doesn't bring new information: size will be divisible by alignment. Anything wrong with the simple fix: pick an integer type with the largest size dividing the original struct type size? Alexander