public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gcc-patches@gcc.gnu.org
Cc: richard.guenther@gmail.com (Richard Guenther),
	       stevenb.gcc@gmail.com (Steven Bosscher),
	dnovillo@google.com,        froydnj@codesourcery.com
Subject: [4.5 regression] C++ ignores some aligned attributes (Re: [PATCH] fix arm neon ICE by widening tree_type's precision field)
Date: Wed, 28 Jul 2010 19:01:00 -0000	[thread overview]
Message-ID: <201007281836.o6SIae5w007891@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20090609163111.GA21107@codesourcery.com> from "Nathan Froyd" at Jun 09, 2009 09:31:11 AM

Nathan Froyd wrote:

> 2009-06-09  Nathan Froyd  <froydnj@codesourcery.com>
> 
> 	* 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

  parent reply	other threads:[~2010-07-28 18:36 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 15:32 [PATCH] fix arm neon ICE by widening tree_type's precision field Nathan Froyd
2009-06-08 17:11 ` Richard Guenther
2009-06-08 18:04 ` Paolo Bonzini
2009-06-08 20:28   ` Nathan Froyd
2009-06-08 20:32     ` Steven Bosscher
2009-06-09  6:36     ` Paolo Bonzini
2009-06-09 14:54       ` Nathan Froyd
2009-06-09 15:00         ` Richard Guenther
2009-06-09 15:07           ` Richard Guenther
2009-06-09 15:44           ` Steven Bosscher
2009-06-10  2:50           ` Eric Botcazou
2009-06-09 15:40         ` Steven Bosscher
2009-06-09 15:53           ` Richard Guenther
2009-06-09 16:31             ` Nathan Froyd
2009-06-09 16:34               ` Richard Guenther
2009-06-09 16:36               ` Diego Novillo
2009-06-09 17:30               ` Paolo Bonzini
2010-07-28 19:01               ` Ulrich Weigand [this message]
2010-07-28 19:40                 ` [4.5 regression] C++ ignores some aligned attributes (Re: [PATCH] fix arm neon ICE by widening tree_type's precision field) Richard Guenther
2010-07-29 12:29                   ` [4.5 regression] C++ ignores some aligned attributes (Re: [PATCH] fix arm neon ICE by widening tree_type's precision field Ulrich Weigand
2010-07-28 22:07                 ` [PATCH] [4.5 regression] C++ ignores some aligned attributes Ulrich Weigand
2010-07-30 16:00                   ` Ulrich Weigand
2010-07-30 16:22                     ` Richard Guenther
2010-07-30 16:22                       ` Ulrich Weigand
2010-07-31 17:45                   ` Eric Botcazou
2010-07-31 19:38                     ` Ulrich Weigand
2010-08-04 14:03                   ` Paul Brook
2010-08-04 14:19                     ` Ulrich Weigand
2010-08-04 14:27                       ` Mark Mitchell
2010-08-04 15:04                       ` Paul Brook
2010-08-04 16:42                         ` Ulrich Weigand
2010-08-04 15:33                       ` Martin Sebor
2010-08-04 15:47                         ` Mark Mitchell
2010-08-05  9:02                           ` Martin Sebor
2009-06-08 19:40 ` [PATCH] fix arm neon ICE by widening tree_type's precision field Joseph S. Myers
2009-06-08 19:52   ` Daniel Jacobowitz
2009-06-08 20:12     ` Andrew Pinski
2009-06-08 20:20     ` Jakub Jelinek
2009-06-08 20:33       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201007281836.o6SIae5w007891@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=dnovillo@google.com \
    --cc=froydnj@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=stevenb.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).