From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28200 invoked by alias); 4 Aug 2010 14:19:45 -0000 Received: (qmail 28038 invoked by uid 22791); 4 Aug 2010 14:19:42 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.17.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 Aug 2010 14:19:17 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.1/8.13.1) with ESMTP id o74EJCe3026582 for ; Wed, 4 Aug 2010 14:19:12 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o74EJCUr1790114 for ; Wed, 4 Aug 2010 16:19:12 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o74EJCUa011794 for ; Wed, 4 Aug 2010 16:19:12 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id o74EJAXY011360; Wed, 4 Aug 2010 16:19:10 +0200 Message-Id: <201008041419.o74EJAXY011360@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 04 Aug 2010 16:19:10 +0200 Subject: Re: [PATCH] [4.5 regression] C++ ignores some aligned attributes To: paul@codesourcery.com (Paul Brook) Date: Wed, 04 Aug 2010 14:19:00 -0000 From: "Ulrich Weigand" Cc: gcc-patches@gcc.gnu.org, richard.guenther@gmail.com (Richard Guenther), stevenb.gcc@gmail.com (Steven Bosscher), dnovillo@google.com, froydnj@codesourcery.com, mark@codesourcery.com (Mark Mitchell) In-Reply-To: <201008041503.30624.paul@codesourcery.com> from "Paul Brook" at Aug 04, 2010 03:03:28 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2010-08/txt/msg00287.txt.bz2 Paul Brook wrote: > I'm not so sure. Consider the following example: > > struct JSString > { > unsigned char mLength; > static JSString unitStringTable[]; > }; > > int var1 =__alignof__ (JSString::unitStringTable); > > JSString JSString::unitStringTable[] __attribute__ ((aligned (8))) = { 1 }; > int var2 =__alignof__ (JSString::unitStringTable); > > int main() > { > assert(var1 == var2); > } > > Note that var1 may be in a separate file, and never see the additional > attribute. > > Should we be rejecting this mismatch, rather than papering over what looks > like user error? If the packed attribute can reduce alignment then this is > going to cause havoc on STRICT_ALIGN targets. Well, the only thing my patch does is to revert behavior back to what it was in 4.4 and earlier, after having been (clearly inadvertently) changed by an unrelated patch. At least Firefox relies on that behavior; Firefox builds would certainly break if we add the error you suggest ... That said, I have no strong opinion on what the behavior *should* be in the case of differing aligned attributes between declaration and definition. (However, I would suggest to keep the behavior the same between C and C++ whereever that makes sense.) Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com