public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Andrew Haley <aph@redhat.com>
Cc: Michael Matz <matz@suse.de>, <gcc@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Jason Merrill <jason@redhat.com>
Subject: Re: On alignment
Date: Tue, 25 Mar 2003 02:52:00 -0000	[thread overview]
Message-ID: <wvlptognqe1.fsf@prospero.boston.redhat.com> (raw)
In-Reply-To: <15996.10496.282670.431066@cuddles.cambridge.redhat.com> (Andrew Haley's message of "Sat, 22 Mar 2003 09:12:32 +0000 (GMT)")

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

On Sat, 22 Mar 2003 09:12:32 +0000 (GMT), Andrew Haley <aph@redhat.com> wrote:

> Jason Merrill writes:
>  > Can you give me an example of a case that needs an aligned attribute?  What
>  > is the Java frontend doing that makes this necessary?
>
> http://gcc.gnu.org/ml/gcc-patches/2003-03/msg00429.html

OK, you're trying to suppress the tail padding optimization.  It occurred
to me that another way to express that could be

  struct B : A {
    // force normal alignment
    char : 0 __attribute ((__aligned (__alignof (A))));
    short bs;
  };

but of course that doesn't work properly either; user-specified alignment
is currently ignored on a zero-length bitfield.  But that's a one-line fix,
and shouldn't create a compatibility problem, since there would have been
no point in specifying such an alignment before.  Would that work for you?

We may well still want to fix the other bugs, but perhaps not in 3.3.  I'm
still interested in other opinions.

Jason


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 768 bytes --]

*** stor-layout.c.~1~	2003-01-26 04:02:25.000000000 -0500
--- stor-layout.c	2003-03-24 19:26:55.000000000 -0500
*************** update_alignment_for_field (rli, field, 
*** 758,764 ****
  	 within the structure.  */
        if (! integer_zerop (DECL_SIZE (field)))
  	rli->record_align = MAX (rli->record_align, desired_align);
!       else if (! DECL_PACKED (field))
  	desired_align = TYPE_ALIGN (type);
  
        /* A named bit field of declared type `int'
--- 758,764 ----
  	 within the structure.  */
        if (! integer_zerop (DECL_SIZE (field)))
  	rli->record_align = MAX (rli->record_align, desired_align);
!       else if (! DECL_PACKED (field) && !user_align)
  	desired_align = TYPE_ALIGN (type);
  
        /* A named bit field of declared type `int'

  reply	other threads:[~2003-03-25  2:15 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-21  0:25 Jason Merrill
2003-03-21 11:49 ` Andrew Haley
2003-03-21 15:18   ` Andrew Haley
2003-03-21 19:31   ` Tom Tromey
2003-03-21 15:39 ` Michael Matz
2003-03-21 15:41   ` Andrew Haley
2003-03-22  0:25     ` Jason Merrill
2003-03-22  9:35       ` Tom Tromey
2003-03-22 10:31       ` Andrew Haley
2003-03-25  2:52         ` Jason Merrill [this message]
2003-03-25 10:16           ` Andrew Haley
2003-03-25 16:48 Kevin B. Hendricks
2003-03-25 18:39 ` Jason Merrill
2003-03-25 18:41   ` Jason Merrill
2003-03-25 19:14     ` Kevin B. Hendricks
2003-03-25 19:57       ` Jason Merrill
2003-04-22 11:36         ` Andrew Haley
2003-04-22 12:05           ` Nathan Sidwell
2003-04-22 12:37             ` Andrew Haley
2003-04-22 13:15           ` Andreas Schwab
2003-04-23 13:32             ` Jamie Lokier
2003-04-23 16:07               ` Jason Merrill
2003-04-23 17:41               ` Tom Tromey
2003-04-23 18:06                 ` Jason Merrill
2003-04-23 18:42                   ` Tom Tromey
2003-04-23 19:13                     ` Jason Merrill
2003-04-23 19:43                       ` Gabriel Dos Reis
2003-04-23 20:23                         ` Tom Tromey
2003-04-23 21:45                           ` Gabriel Dos Reis
2003-04-24  7:00                           ` Jason Merrill
2003-04-24 11:45                             ` Andrew Haley
2003-05-01 23:50                               ` Tom Tromey
2003-05-02 13:08                                 ` Gabriel Dos Reis
2003-05-05 14:56                                   ` Jason Merrill
2003-05-08  9:58                                     ` Gabriel Dos Reis
2003-04-23 19:33                     ` Gabriel Dos Reis
2003-04-24  1:32                     ` Jamie Lokier
2003-03-25 21:27       ` Tom Tromey
2003-03-26 12:58         ` Andrew Haley
2003-03-26 22:26           ` Mark Mitchell
2003-03-25 18:57   ` Tom Tromey
2003-04-22 14:43 Robert Dewar
2003-04-22 15:13 ` Andrew Haley
2003-04-22 16:22   ` Jason Merrill
2003-04-22 16:26     ` Nicola Pero
2003-04-22 17:19       ` Andrew Haley
2003-04-22 18:46       ` Jason Merrill
2003-04-22 17:17     ` Andrew Haley
2003-04-22 17:19 Robert Dewar
2003-04-23 19:34 Joern Rennecke
2003-04-23 19:47 Robert Dewar

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=wvlptognqe1.fsf@prospero.boston.redhat.com \
    --to=jason@redhat.com \
    --cc=aph@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=matz@suse.de \
    /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).