From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4648 invoked by alias); 28 Jul 2010 18:36:54 -0000 Received: (qmail 4639 invoked by uid 22791); 28 Jul 2010 18:36:52 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.17.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Jul 2010 18:36:45 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.1/8.13.1) with ESMTP id o6SIagE1020878 for ; Wed, 28 Jul 2010 18:36:42 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 o6SIagxI1749220 for ; Wed, 28 Jul 2010 20:36:42 +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 o6SIafXd007896 for ; Wed, 28 Jul 2010 20:36:42 +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 o6SIae5w007891; Wed, 28 Jul 2010 20:36:40 +0200 Message-Id: <201007281836.o6SIae5w007891@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 28 Jul 2010 20:36:40 +0200 Subject: [4.5 regression] C++ ignores some aligned attributes (Re: [PATCH] fix arm neon ICE by widening tree_type's precision field) To: gcc-patches@gcc.gnu.org Date: Wed, 28 Jul 2010 19:01:00 -0000 From: "Ulrich Weigand" Cc: richard.guenther@gmail.com (Richard Guenther), stevenb.gcc@gmail.com (Steven Bosscher), dnovillo@google.com, froydnj@codesourcery.com In-Reply-To: <20090609163111.GA21107@codesourcery.com> from "Nathan Froyd" at Jun 09, 2009 09:31:11 AM 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-07/txt/msg02214.txt.bz2 Nathan Froyd wrote: > 2009-06-09 Nathan Froyd > > * tree.h (tree_base): Add packed_flag and user_align fields. > Decrease size of spare field. > (TYPE_USER_ALIGN): Use user_align from tree_base. > (DECL_USER_ALIGN): Likewise. It seems this broke attribute ((aligned)) handling for certain cases in C++, which causes crashes in the Mozilla JavaScript interpreter under some circumstances. I've opened PR c++/45112 for this problem. The bug occurs with code like the following: struct JSString { unsigned char mLength; static JSString unitStringTable[]; }; JSString JSString::unitStringTable[] __attribute__ ((aligned (8))) = { 1 }; (extracted and simplified from Mozilla), where the aligned attribute seems to be simply ignored from 4.5 on. The C++ front-end sees two DECLs here, one for the declaration (with DECL_USER_ALIGN cleared) and one for the definition (with DECL_USER_ALIGN set). These are supposed to be merged by cp-decl.c:duplicate_decls. Before this patch, this would happen inside the following memcpy: memcpy ((char *) olddecl + sizeof (struct tree_common), (char *) newdecl + sizeof (struct tree_common), sizeof (struct tree_decl_common) - sizeof (struct tree_common)); which copied everything in tree_decl_common, *except* what is in tree_common. Now, the patch unfortunately moves the user_align (and packed_flag) fields out of the area copied by this memcpy, and into tree_common. It seems this means it now ought to be handled manually, but this code is missing ... I'll try to come up with a fix. Any thoughts from C++ folks? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com