public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/31319]  New: Make big alignment for structs/arrays configurable
@ 2007-03-22 19:55 vda dot linux at googlemail dot com
  2007-03-22 20:08 ` [Bug c/31319] " vda dot linux at googlemail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vda dot linux at googlemail dot com @ 2007-03-22 19:55 UTC (permalink / raw)
  To: gcc-bugs

Hi from busybox project.

We are concerned about gcc sometimes aligning structs and arrays to 256 bits on
i386. We would like to be able to disable it. The proposal is to implement new
x86-specific -m option, -mbigdata_align=N. N specifies how big the struct/array
should be in order to be "strongly" aligned.

Run-tested patch against 4.1.2 is attached.


-- 
           Summary: Make big alignment for structs/arrays configurable
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vda dot linux at googlemail dot com
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31319


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/31319] Make big alignment for structs/arrays configurable
  2007-03-22 19:55 [Bug c/31319] New: Make big alignment for structs/arrays configurable vda dot linux at googlemail dot com
@ 2007-03-22 20:08 ` vda dot linux at googlemail dot com
  2007-03-22 21:15 ` [Bug target/31319] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vda dot linux at googlemail dot com @ 2007-03-22 20:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from vda dot linux at googlemail dot com  2007-03-22 20:07 -------
Patch is available here:

http://busybox.net/~vda/mbigdata_align.diff

I cannot attach patch to this bugzilla entry because I get this:

"Internal Error

GCC Bugzilla has suffered an internal error. Please save this page and send it
to dberlin@gcc.gnu.org with details of what you were doing at the time this
message appeared.

URL: http://gcc.gnu.org/bugzilla/attachment.cgi
undef error - Undefined subroutine Fh::slice at
data/template/template/en/default/global/hidden-fields.html.tmpl line 58"

I already saw this error page ~1 year ago, IIRC. Pity it didn't get more
understandable over this time.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31319


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/31319] Make big alignment for structs/arrays configurable
  2007-03-22 19:55 [Bug c/31319] New: Make big alignment for structs/arrays configurable vda dot linux at googlemail dot com
  2007-03-22 20:08 ` [Bug c/31319] " vda dot linux at googlemail dot com
@ 2007-03-22 21:15 ` pinskia at gcc dot gnu dot org
  2007-03-23 12:00 ` vda dot linux at googlemail dot com
  2007-04-28  0:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-22 21:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-03-22 21:14 -------
I think this has already been fixed for -Os in 4.2.0 or 4.3.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31319


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/31319] Make big alignment for structs/arrays configurable
  2007-03-22 19:55 [Bug c/31319] New: Make big alignment for structs/arrays configurable vda dot linux at googlemail dot com
  2007-03-22 20:08 ` [Bug c/31319] " vda dot linux at googlemail dot com
  2007-03-22 21:15 ` [Bug target/31319] " pinskia at gcc dot gnu dot org
@ 2007-03-23 12:00 ` vda dot linux at googlemail dot com
  2007-04-28  0:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: vda dot linux at googlemail dot com @ 2007-03-23 12:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from vda dot linux at googlemail dot com  2007-03-23 12:00 -------
You are right, in current svn it is fixed.
BTW I think I see a bug created by this change: with -Os x86_86 ABI will be
violated - arrays larger than 16 bytes will still be aligned only to 4 bytes
because if's are in wrong order. shouldn't they be swapped?

(nitpicking: if comment is true, then second if should check that object is an
*array*, not a *struct*, but it doesn't seem to do it)

  int max_align = optimize_size ? BITS_PER_WORD : 256;

  if (AGGREGATE_TYPE_P (type)
      && TYPE_SIZE (type)
      && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
      && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= (unsigned) max_align
          || TREE_INT_CST_HIGH (TYPE_SIZE (type)))
      && align < max_align)
    align = max_align;

  /* x86-64 ABI requires arrays greater than 16 bytes to be aligned
     to 16byte boundary.  */
  if (TARGET_64BIT)
    {
      if (AGGREGATE_TYPE_P (type)
           && TYPE_SIZE (type)
           && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
           && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 128
               || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 128)
        return 128;
    }


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31319


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/31319] Make big alignment for structs/arrays configurable
  2007-03-22 19:55 [Bug c/31319] New: Make big alignment for structs/arrays configurable vda dot linux at googlemail dot com
                   ` (2 preceding siblings ...)
  2007-03-23 12:00 ` vda dot linux at googlemail dot com
@ 2007-04-28  0:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-28  0:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-04-28 01:34 -------
> BTW I think I see a bug created by this change: with -Os x86_86 ABI will be
> violated - arrays larger than 16 bytes will still be aligned only to 4 bytes
> because if's are in wrong order. shouldn't they be swapped?

There is no return for the non x86-64 "if" so no there is no violation.

Closing as fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31319


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-28  0:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-22 19:55 [Bug c/31319] New: Make big alignment for structs/arrays configurable vda dot linux at googlemail dot com
2007-03-22 20:08 ` [Bug c/31319] " vda dot linux at googlemail dot com
2007-03-22 21:15 ` [Bug target/31319] " pinskia at gcc dot gnu dot org
2007-03-23 12:00 ` vda dot linux at googlemail dot com
2007-04-28  0:34 ` pinskia at gcc dot gnu dot org

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).