Bug 33774 - Cygwin/mingw do not support 16 byte alignment of struct/union fields
Summary: Cygwin/mingw do not support 16 byte alignment of struct/union fields
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Danny Smith
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-14 23:46 UTC by Danny Smith
Modified: 2007-11-08 20:21 UTC (History)
2 users (show)

See Also:
Host: i686-pc-mingw32
Target: i686-pc-mingw32
Build: i686-pc-mingw32
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Danny Smith 2007-10-14 23:46:58 UTC
The following testcase fails on mingw32 
=======================================================================
typedef int __m128 __attribute__ ((__vector_size__ (16), __may_alias__));

typedef union 
{
   float f[4];
   __m128 m;
} foo;

int test1[__alignof(__m128) >= 16 ? 1 : -1 ];  // OK
int test2[__alignof(foo) >= 16 ? 1 : -1 ]; // Fails: alignof foo = 8
========================================================================

with:
> foo.c:11: error: size of array 'test2' is negative.



The problem is config/i386/cygming.h 

#define BIGGEST_FIELD_ALIGNMENT 64

which is a leftover from a time when this define was necessary and
sufficient to enable 8 byte alignment for doubles--consistent with the
target default MASK_ALIGN_DOUBLE--and when GNU ld could only handle 8
byte alignment.

Currently testing a patch.
Comment 1 patchapp@dberlin.org 2007-10-15 02:15:33 UTC
Subject: Bug number PR target/33774

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-10/msg00853.html
Comment 2 Danny Smith 2007-10-18 21:04:00 UTC
The native compiler MSVC++ does not limit field alignment to 64 bits, but as documented here 
Windows Data Alignment on IPF, x86, and x64
http://msdn2.microsoft.com/en-us/library/Aa290049(VS.71).aspx

supports at least up to 256-bit field alignment  (see Listing 5 in above article).
Comment 3 dannysmith@gcc.gnu.org 2007-11-08 20:20:13 UTC
Subject: Bug 33774

Author: dannysmith
Date: Thu Nov  8 20:20:02 2007
New Revision: 130024

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130024
Log:
	PR target/33774
	* config/i386/cygming.h (BIGGEST_FIELD_ALIGNMENT): Define only if
	IN_TARGET_LIBS.



Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/cygming.h

Comment 4 Danny Smith 2007-11-08 20:21:39 UTC
Fixed on trunk.
Danny