From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29474 invoked by alias); 28 Jul 2010 18:24:45 -0000 Received: (qmail 29009 invoked by uid 48); 28 Jul 2010 18:24:18 -0000 Date: Wed, 28 Jul 2010 18:24:00 -0000 Subject: [Bug c++/45112] New: [4.5/4.6 regression] Aligned attribute on static class member definition ignored X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "uweigand at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg03127.txt.bz2 Building the following testcase fails with G++ 4.5 and later. G++ 4.4 works fine. struct JSString { unsigned char mLength; static JSString unitStringTable[]; }; JSString JSString::unitStringTable[] __attribute__ ((aligned (8))) = { 1 }; int bug [__alignof__ (JSString::unitStringTable) >= 8 ? 1 : -1]; The test case is reduced from Mozilla, where the bug sometimes causes the JavaScript interpreter to crash. See also: https://bugzilla.mozilla.org/show_bug.cgi?id=582593 The problem appears to be that cp-decl.c:duplicate_decls fails to merge the DECL_USER_ALIGN flag from the definition into the declaration. This bug was introduced by the following patch: http://gcc.gnu.org/ml/gcc-patches/2009-06/msg00763.html Before that patch, the DECL_USER_ALIGN flag was part of a block copied in whole via memcpy by duplicate_decls. The patch moved that flag to another location outside that block, so it is no longer copied ... -- Summary: [4.5/4.6 regression] Aligned attribute on static class member definition ignored Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: uweigand at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45112