From patchwork Thu Sep 30 08:34:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 66138 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]) by ozlabs.org (Postfix) with SMTP id 9AB6CB70F6 for ; Thu, 30 Sep 2010 18:34:38 +1000 (EST) Received: (qmail 13353 invoked by alias); 30 Sep 2010 08:34:36 -0000 Received: (qmail 13136 invoked by uid 22791); 30 Sep 2010 08:34:34 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from outdoor.onevision.de (HELO outdoor.onevision.de) (212.77.172.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Sep 2010 08:34:29 +0000 Received: from sanders.onevision.de (moonrace [212.77.172.62]) by outdoor.onevision.de (8.14.3/8.13.7/ROSCH/DDB) with ESMTP id o8U8YJfE020393; Thu, 30 Sep 2010 10:34:24 +0200 In-Reply-To: <1285834144.02415927@192.168.2.227> To: "Nicola Pero" Cc: "IainS" , gcc-patches@gcc.gnu.org, "Kai Tietz" Subject: Re: [patch objc]: Fix issue about LLP64 and -Wpadded MIME-Version: 1.0 X-KeepSent: 184808F8:06E0EB41-C12577AE:002EEBE7; type=4; name=$KeepSent Message-ID: From: Kai Tietz Date: Thu, 30 Sep 2010 10:34:22 +0200 X-IsSubscribed: yes 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 "Nicola Pero" wrote on 30.09.2010 10:09:04: > > > Well, the trouble is comming here by the fact that we have 3 long > > types in series within this structure. For targets with sizeof (long) > > == sizeof (void *) this code works. As windows 64 has sizeof (long) == > > 4 and sizeof (void *) == 8, there is an implicit alignment done. > > To use here the packed attribute was one of my first tries to fix it, > > but sadly it didn't lead to working executables, as compiler itself > > emits data aligned, so declaration of structure in header doesn't fit > > to actual generated data structure layout of compiler. > > Thanks Kai > > just for me to understand what you are trying to fix - without your patch, > everything works, but anything that compiles using -Wpadded and includes > objc/objc-api.h prints a warning ? Is that what happens ? Yes, you got it absolute right. > I guess that makes it important to fix, since it would mean that using > -Wpadded with Objective-C produces lots of warning that the GCC user can't > do anything about. Yes, this can be noticed by some testcases in objc's testsuite, which are using -Wpadded option. > If that's the case, your fix does look reasonable and meaningful, but I would > suggest you add a fat, descriptive comment explaining it. Can you repost it > with such a comment added ? > > Thanks a lot for looking into this! :-) > Does this comment looks ok for you? If so, ok for apply? Regards, Kai | (\_/) This is Bunny. Copy and paste Bunny | (='.'=) into your signature to help him gain | (")_(") world domination. variables in the class @@ -42,3 +49,4 @@ struct objc_protocol_list *protocols; /* Protocols conformed to */ void* gc_object_type; }; + --- struct_objc_class.h (revision 164743) +++ struct_objc_class.h (working copy) @@ -24,6 +24,13 @@ The sum of the class definition and all super class definitions. */ +#ifdef _WIN64 + /* We do here structure padding manual. This is done by compiler + automatically, but would lead in combination with -Wpadded to + annoying warnings. This padding is necessary as on LLP64 targets + sizeof (long) isn't equal to sizeof (void *). */ + long pad; +#endif struct objc_ivar_list* ivars; /* Pointer to a structure that describes the instance